Well, here’s a quote from the WSJ article that the Motley Fool references, which admits that SpaceX was profitable before their mishaps in 2015 and 2016:
That June 2015 disaster, followed by months of launch delays, contributed to a quarter-billion dollar annual loss and a 6% drop in revenue, after several years of surging sales and small profits.
...
Since the mishap in September of 2016, SpaceX has had a perfect record and they now dominate the global commercial launch market. They save the taxpayers and launch customers a lot of money by driving down launch costs. SpaceX has an estimated private value between $25 billion and $30 billion based on their latest placements.
Corporations have a market value, and while you may disagree with the value of Musk’s companies, he has a long and successful record of creating companies that are highly profitable for investors. That includes Zip2, Paypal, TSLA, and SpaceX. And in the future probably the Boring Company.