In the absence of additional jurisdiction establishing facts like a choice of forum clause in the contract or in person negotiations in Maine, the Maine seller would probably have to sue the California buyer in California.
If Maine does have jurisdiction to hear the case, for example, due to a choice of forum clause in the contract, the merits of the amount owed could be litigated to judgment in Maine. But, even then, if the buyer only had assets in California, the Maine judgment would have to be recognized in a California court (which is fairly quick, easy, and non-discretionary for the California court to do) and then the post-judgment collection activities would have to be conducted in courts located in California.
If the California purchaser went bankrupt, the bankruptcy case would also be in California in all likelihood.
You can always sue where the defendant is located, which is also the place of performance of the contract. This has a 100% chance of succeeding as to jurisdiction and venue (and could be done in federal court if one feared being hometowned by local counsel my familiar with California law than your lead Maine counsel).
In a consumer contract, you must sue where the defendant is located pursuant to the Fair Debt Collection Practices Act, and a contrary contractual term is void as contrary to the controlling federal law.
In a business to business contact, however, the parties may include a choice of forum and choice of law clause in the contract that would be controlling, and the Uniform Commercial Code "battle of forms" provisions permit the seller's form to be binding in some circumstances even if that term is not in a document signed by the other side. This would be upheld if the forum had any meaningful connection to either of the parties. (Also, for what it is worth, once there is part performance of the contract due to the delivery of goods, the Uniform Commercial Code's statute of frauds no longer bars enforcement of the contract.)
In the absence of a choice of forum term in the contract, the analysis in the case of a Maine forum would be to determine whether California company had sufficient minimum contacts with the state of Maine in this transaction to have "purposefully availed itself" of the laws of Maine by doing business in Maine. This is a fact rich inquiry in which almost any fact that you can imagine about the transaction could be relevant.
In this fact pattern, the personal jurisdiction issue is less open and shut, especially if no one affiliated with the buyer has ever been present in the seller's state. The odds of a Maine court determining that it doesn't have jurisdiction are not zero but I'd hesitate to put an exact percentage on it.
The most factually similar case that I could locate held that Maine courts did not have jurisdiction over a similarly situated purchaser, where a headnote to the case explains that:
Where only contact between purchaser of spiral staircase and
manufacturer-seller arose from purchase, there was no indication that
purchaser ever set foot in or conducted any business in state, and
only affiliating circumstances were that purchaser ordered staircase
from manufacturer-seller, and he communicated with seller by telephone
and mail with respect to that order, district court lacked personal
jurisdiction over purchaser in manufacturer-seller's action seeking
damages from purchaser for breach of contract and conversion after
purchaser stopped payment on check for staircase but retained
Architectural Woodcraft Co. v. Read, 464 A.2d 210 (Me. 1983).
So, to successfully sue in Maine, one would have to distinguish this binding precedent of Maine's highest court with additional facts showing that the purchaser had a greater connection to the State of Maine than this one did.
Another worthwhile point to consider is that any determination that Maine did not have jurisdiction would be made very early in the case, with the matter full briefed and ready to rule upon or to call for a hearing upon within perhaps two months of service of process on the defendant. The issue probably gets resolved with a hearing if necessary within six months or so. Litigating jurisdiction is much cheaper than litigating the entire case, and if you lose in Maine you just refile in California (probably with acceptance of service of process by the lawyers who appeared on behalf of the California firm in Maine). As long as you aren't close to the statute of limitations, that isn't a huge deal, even though it is a bump in the road.
As a practical matter, one reasons that a Maine company might want to sue in California is that it removes one step from the collection process. If the Maine company gets a judgment against the California company in a Maine court (possibly removed to federal court), the judgment entered would then have to be registered in California before it could be enforced if the debtor only has assets in California. California has to recognize the judgment if it was entered with valid personal and subject matter jurisdiction in Maine (under the U.S. Constitution's full faith and credit clause), but it still involves an extra step that requires time and money, and if the debtor only has assets in California, subsequent collection of the transferred California judgment, by garnishment of bank accounts, garnishment of amounts owed to the debtor, placing judgment liens on real property, and using a writ of execution to attach tangible personal property of the judgment debtor and having the seized property sold to pay the debt, as well as service of interrogatories on the debtor regarding where its assets are located, would all have to be done in the California court system or in the federal courts of California.
If the judgment in Maine was entered by default, the judgment debtor could collaterally attack jurisdiction in the California enforcement proceeding. If the judgment in Maine was entered after the defendant in California contested jurisdiction (which consists of personal jurisdiction authority, service of process, and subject matter jurisdiction of the court in question) in Maine (which is the only way it could contest the merits if the Maine court found that it had jurisdiction over the California firm), however, it could not collaterally attack the Maine Court's jurisdiction in California during the enforcement proceedings.
In real life, a lawyer and client have to assess the risks and benefits and costs of each approach and decide how to handle it, based in part upon how they think that the defendant will behave in litigation. If the merits are likely to be contested and the defendant is easily collectible, fighting in Maine is more desirable to push for even if it isn't a sure thing. If the merits are a foregone conclusion but collection may be more involved, starting in California may make sense.
Also, if the merits are undisputed, often the case will end up in a debtor forum bankruptcy case before the judgment obtained in either location can be used to collect that judgment in the California courts. This is because companies that don't pay undisputed debts are usually unable to pay many creditors and not just one in particular.
Furthermore while in theory, this case would present distinct issues of state law and federal law, Maine, like most states, takes the position that its state courts have jurisdiction over essentially all cases over which the U.S. Constitution allows it to assert jurisdiction, so the ultimate analysis pretty much boils down to one under federal constitutional law.
So, while you look to state court precedents first, those precedents are driven by U.S. Supreme Court precedents that greatly narrow the range of discretion which state courts may exercise in deciding these cases. As a result, the outcome is likely to be reasonably similar in pretty much any combination of two U.S. states, even though it wouldn't be precisely uniform and the determinations are highly amenable to being distinguished factually from each other.
The substantive law of the case, as opposed to the jurisdictional law, would be governed almost entirely by Article 2 of the Uniform Commercial Code which while it is enacted separately as state law in each state is almost identical in every U.S. state. There might be a difference in the statute of limitations, and there might be civil procedure differences, however (although the civil procedure differences would be muted by the power of either party to remove the case to federal court if the amount in controversy exceeded $75,000).