These companies are never just one person's money, even if they're a billionaire. He went to investors, institutional, and so on, and he did also put money himself, but its mixed funding. And when it was on the verge of bankruptcy, their 4th attempt at self-landing rockets (after 3 failures) showed some promise, so NASA saved them financially by awarding them with a $1.6 billion contract. SpaceX is about 85% funded by the federal government, 15% by Elon and other investors.
NASA gave SpaceX billions, at a time they were near bankrupt, and with no final working products, with the idea at some point in the future SpaceX will do something in return. Investors that fund a startup also give money expecting something in return in the future.
The difference between investor and customer is only one of scale. How much money and what timeframe for return. As that increases risk, accordingly.
When you pay for a house or an apartment that's not built yet, you're investing in construction, you're not a "customer". Of course you expect a house and/or an apartment in a few years. But you invested your money, and that house/apartment may not materialize.
So NASA was an investor. Today they're also a customer, but they're still an investor. Some of their money blew up two days ago.