And immediately after the 4th one flew, someone (NASA?) handed them a contract, which is kinda nuts.
Then ULA got monopolist prices ($400 million for a Delta IV Heavy launch!) for years and a sweet billion dollars per year for maintaining the capability even if no launches happen that year.
Falcon 1 was developed using private money.
Falcon 9 and Dragon 1 were developed using 396 million of government money from NASA COTS program, and about a billion dollars of private money (for upgrades and reusability).
Falcon Heavy was developed using half a billion of private money.