SpaceX has sunk enormous sums into building and launching thousands of their own satellites. Roughly one half of all operating satellites.
Their investment dollars up to now have also covered development of their next rocket, with planned capabilities of refueling in space and round trips, including site landings, to anywhere in the solar system, and have a greater lift capacity than the SLS, beyond their current achievements in rocketry.
They also had to, from scratch, develop an organization, build out design, manufacturing and flight control capacities, their own launch facilities including unique water landing platforms.
NASA already had extensive facilities and capabilities, prior to their latest rocket project.
Of course, both NASA and SpaceX were able to leverage NASA's previous experience with rocketry. (I am a fan, not a critic of NASA.)
> NASA reports the official cost of the SLS as $11.8 billion [1]
> NASA estimates will cost $13.8 billion to develop through its first crewed launch in 2024. [1]
That doesn't cover the costs of additional rockets. Which get discarded after every launch.
> each SLS/Orion launch will have a price tag of about $4.1 billion. [2]
When you consider the cost of NASA launches vs. SpaceX launches, there are now between an order or two of magnitudes between them. Which is reflected in SpaceX launch prices. Starship will eliminate the second stage losses, resulting in even cheaper per launch costs.
I cannot think of another time in history where a company has managed to so decisively leave all competition, including major strategic nation-state initiatives, behind.
[1] https://www.planetary.org/space-policy/cost-of-sls-and-orion....
[2] https://www.space.com/artemis-1-space-launch-system-rocket-c....
-- EDIT --
Not sure how I missed the opening paragraph of [1]:
> From its inception in 2011 through the year of its first flight, the Space Launch System rocket program has cost $23.8 billion. The Orion deep space capsule has cost $20.4 billion since the program began in 2006. Related ground infrastructure upgrades cost an additional $5.7 billion since 2012. In total, NASA spent $49.9 billion on these programs between 2006 and their first test launch in 2022.
$49.9 Billion!