Depends. The original Falcon 1 funding mostly came from Musk and a few friends.
Then for the Falcon 9, they got the COTS contract for resupply of the station. Or rather they got a contract that would pay money if they were successful in executing. This funding was mostly for the Dragon Space craft, but it also funded Falcon 9. But that was a much smaller number then Ariane 6.
Then SpaceX got Commercial Crew, for 2.6 billion $. That mostly funded Crew Dragon space craft. But it also required human rating of Falcon 9. So those 2.6 billion $ were not assigned X amount for Dragon, Y for Falcon 9. SpaceX was just required to launch people to ISS and bring them back with NASA overview. During this time SpaceX finished the Block 5 version, and that was human rated.
Beyond that SpaceX did most of the development on the re-usability of Falcon 9 on their own money. They used costumer missions to do a lot of the testing. But importantly, SpaceX never got any money from NASA to develop re-usability.
Same goes for Falcon Heavy. SpaceX sold Falcon Heavy to DoD but they didn't get any development contract for the rocket itself. Falcon Heavy was fully developed by SpaceX on their own money.
SpaceX did miss out on a major DoD development funding when they bid Starship and DoD did want it. Other companies like BlueOrigin and ULA got a huge amount of money.
Both Raptor and Starship were mostly on SpaceX as well. A very early version of Raptor, when it was very different from what is now, once got a DoD research contract. Only when there was a competition for Human Moon Lander System, and Starship got selected, was government spending any money on Starship. And HLS is milestone based, so that will help SpaceX a little to pay for Starship. But a lot of that money will go into the customized version of Starship for use as a moon lander.
Starlink is basically fully funded by SpaceX. There never was any development money.
So in totality, SpaceX doesn't really get much development money for rockets or engine. They get money for spacecraft (Dragon 1, Crew Dragon, Cargo Dragon), and they just have to make sure they have a rocket that they can launch on. They could also just buy somebody else rocket, but of course that's not what SpaceX wants to do.
For all this stuff, Starship, Starlink and so on, they did raise like 10 billion $. That the majority of their major developments.
They've had multiple private VC rounds. They also have had several milestone based development contracts from the government to develop capabilities (iss cargo and crew mainly) while charging the government less to do that dev work then their competitors bid.
ESA member states contributed €2.815 billion for the development of Ariane 6. Industry contributed €400 million.
Additionally, the member states have agreed to subsidize the Ariane 6 to the tune of €340 million annually.