> The customers will be paid before investors with whatever money is there.
That really depends whether the investment is structured as a secured loan (senior debt) or not. Secured loans get paid out in full, before the unsecured creditors such as customers.
> but the courts decide allocation order
Mostly that is defined by the laws of the jurisdiction, not the individual court.
In the Bahamas, the ranking of creditors and shareholders are as follows[1]:
Creditors with a mortgage or fixed charge: assets secured in this way are outside the scope of the insolvency.
Costs of insolvency proceedings: all costs and expenses properly incurred in the company's winding-up (including liquidator's fees).
Employees' debts: sums due to employees under the terms of their employment contract.
Preferential payments, such as unpaid taxes, contributions to occupational pension schemes and liability for compensation for injury or occupational disease.
Creditors with a floating charge.
Unsecured creditors.
Shareholder loans.
Shareholders' equity.
In the US[2]:
Under the Bankruptcy Code, the priority of allowed claims and interests is, in descending order:
Secured claims.
Administrative expenses and priority claims.
General unsecured claims.
Subordinated claims.
Equity interests.
Outside of bankruptcy, creditor ranking is determined by state law and in certain circumstances, the agreement of the parties, such as in an intercreditor agreement. In bankruptcy, the priority of creditors' claims and interests in a debtor's estate is set out in the Bankruptcy Code.
VC early investments may be a convertible note, often senior debt that can be converted to equity in the next investment round[3].
The costs of insolvency proceedings, or administrative costs, may be determined by the liquidator. The liquidator will generally milk the system (within their legal limitations) as much as possible (extremely high charge-out costs per hour, etcetera), so customers will often get didly squat. A senior liquidator might be charged out at say USD800 per hour, down to the secretary who might be charged out at USD120 per hour. The liquidator’s goal is to charge as many hours as possible, without being so extreme that the court pulls them up on it, or to finish up quickly if there is no more money left to suck.
[1] https://uk.practicallaw.thomsonreuters.com/9-518-5211
[2] https://uk.practicallaw.thomsonreuters.com/7-501-6870
[3] https://www.investopedia.com/terms/s/senior-convertible-note...