I think people are underestimating the costs NASA incurred by being first. Take the X15 for example, its first test flights were without its planned engine because nobody up until that point had ever built a throttleable rocket engine.
Now its well known how to build them and what not to do. I'm not saying NASA is efficient, but direct numerical comparisons like these unnecessarily distort the various differences in history between the two.
The shuttles many deficiencies are rather well documented as well. And it, now had, features that the Dragon rockets don't serve such as the obvious recovery of space payloads for example.
That research would benefit a NASA attempt to build a new launch vehicle as well, yet there's no way they could have done so at anywhere near the cost SpaceX managed (they even acknowledged that with a study).
We're not being armchair historians here, hypothesizing about a world where NASA never existed. We're talking about rocket development in the here and now. And in the real world of today SpaceX is able to build new launch vehicles about 5x cheaper than NASA could.
Versus... an organization that just wants to launch a rocket, building on that data and fundamental research that others spend money doing, but which doesn't have any strong commitment to any of the other priorities (such as releasing new reusable data or basic-science research for others to build on in turn). Of course the latter organization will be cheaper, because the entire organization has a different set of priorities. In particular, NASA's mandate requires it to spend money on trying to make its results constitute scientific advances, i.e. publishable work, releasable data, etc.; whereas Space-X is happy to save money by not doing so.
For example, I've been looking for the FTP site where I can download raw data originating from Space-X and released into the public domain, and I can't find one. That's not very helpful for others who're looking to build on their advances!
If NASA were spending $5 billion a year on developing its own automobiles when they could just buy cars from Toyota or Ford the decision would be a no brainer.
True, if Toyota exists to supply those automobiles. Not, if NASA is the first one to make a automobile.
Remember NASA was the first to make many things which are not available off the shelf.
Nobodys claims NASAs people or its research in the last 60 years sucked.
Edit: so it seems $1.2-$1.5 billion is the accepted figure from outside analysis, but I don't see how this is possible. With a total budget of $7.2 billion in 1985, I don't see how they paid for $10.8 billion in launches.