Falcon 1 got funding from DARPA. Falcon 9 got funding from NASA as part of the effort to develop resupply for ISS. For both efforts there was significant private money put in as well. Musk has said they would have succeeded w/o government money but it would have taken longer, which is debatable.
Let's put it this way - if it wasn't for private entrepreneurship and Musk's vision, SpaceX wouldn't be here no matter what DARPA or NASA would have done.
Elon's leadership drive and capital had the catalyzing effect. Without Elon, all the capital in the world would've gone into laggy bureaucratic procurement and project management pie in the sky bridges to nowhere. ARPA might've done what today's DARPA/NASA does not do.