The government is also involved in lots of other things without exploding costs. I’d say the common thread is the combination of these factors: 1) the service is considered essential by consumers and 2) payments are deferred (by insurance or student loans). So consumers never say no due to rising prices.
To be more specific, the US government. Other governments seem to figure this stuff out, from time to time, but there's something about the FPTP, federal/state split or other such details that's sabotaged efforts here.
We should realize that it isn't a fundamental property of government, just the one we have and we have mechanisms for making changes that we haven't yet tried.
The problem in the present US system, is that it's a bad mixture of private and government involvement. We have the negatives from both acting simultaneously.
5% of patients are half of all costs in the US healthcare system; 1% of patients are 22% of the cost. People over the age of 65 are a greater share of cost in the US system than in universal healthcare systems, because the US doesn't have a big lever for rationing care.
The healthiest half, is 3% of the cost in the system.
A market healthcare system, which is widely considered immoral, will drop many of the most expensive and poorest patients from the system. That's how you can dramatically lower costs in the US system, if you want to go the market route. A market system would particularly focus on the 50% that are only 3% of cost, with costs being far higher for everyone else (resulting in lack of access to expensive treatment for many, and many millions of people would get denied healthcare coverage due to pre-existing conditions).
A universal healthcare system smashes costs by rationing care, and tightly controlling everything from drug prices to healthcare worker salaries.
The US today has neither of those approaches widely implemented. We have a lot of government and private healthcare without enough of the tight cost checks. The obvious outcome, is a perpetual cost spiral until it can't spiral anymore (which is about where we're at now).
Specifically, the government's mostly laissez-faire approach to handling both and, for education at least, its inability to prioritize it above other priorities like declaring war on vague concepts (drugs, crime, terrorism, etc)