According to Mike Griffin who gave them the money,
Substantial amounts of money, hundreds of millions of dollars, are being provided to the private companies. If SpaceX continues on along its current path, it will have received approximately $1.2 billion in government money from the collective programs. I’m rounding, but with this recent $400-plus million award under CCiCap [Commercial Crew integrated Capability], that brings the total SpaceX funding to something around $1.2 billion, maybe a little more.
That’s—I will only say in my view—excessive, especially since in testimony last year the SpaceX founder, Elon Musk, indicated that the private funding involved was not more than $200 million. $100 million of his own money that he had brought in from a prior enterprise, and then he alluded to the fact—I’m trying to recall the testimony on an ad hoc basis, but the point is that there’s less than $200 million of private capital in SpaceX and $1.2 billion of government capital.
https://historycollection.jsc.nasa.gov/JSCHistoryPortal/hist...(Michael Griffin worked closely with Elon before SpaceX was founded at the Mars Society and worked on Brilliant Pebbles and DC-X which the Falcon 9 was based upon)
Given all that government money, it was a low risk private investment for Elon.