It's because flagship spacecraft and things like the LHC are projects that require a budget of several billions and a 25-year commitment. This kind of budget is within reach only of a wealthy nation with stable finances and a stable political system.
I think the budget explanation also explains the pharmco crisis. It takes about a billion and a decade to bring a drug to market, and that's why you see statins, antidepressants and antidiabetics in the pipeline. Meanwhile, antibiotic resistances are going to be a public health crisis, and Chagas disease, sleeping sickness and malaria are major killers in the developing world. A new model is needed here; we don't need to try coroprate sponsorship in space when it's already failing on Earth.
The LHC, yes, various probes, no. I read that the beachball Mars lander was $250m. Another Hubble could be built for far less than the original, because it is a known design.
These are well within the abilities of many billionaires and their corporations.
The real mission was Spirit and Opportunity, and those two are a giant success. With USD 900 million the price tag is four times higher, and this is getting out of reach of even the ultrawealthy.
Consider also the billions thrown around for acquisitions.
And consider that the rovers were on the national news for months. What's that kind of PR worth?
I've often wondered why big corporations, as marketing, don't finance something like launching another Hubble space telescope. The corporate logo would go on the side, the corporation could host a conference to collect and analyze the results, it would be fantastic PR (instead of those silly commercials and celebrity endorsements they spend so much money on).