When medical care is funded by health insurance, you are the person who selects the goods, but you're not the one that pays the price. In some cases, you will never even be informed of the price, you don't want to be. And you rarely find out unless there are "problems".
The insurer doesn't worry if the bills are high, they'll just raise your premiums... but your monkey brain never makes the connection that your poor goods selection resulted in the higher price. It might even be unfair to blame you, even if you are careful which products you purchase, someone else was curious and you're punished with them. This incentivizes you to be less careful, not more. But if bills are really getting out of hand, the insurance company can just deny the claim.
This incentivizes the medical care provider to raise the number on the bills. If half of claims are denied, just double the bills and the math works out. The medical care provider is incentivized to get tricky with the billing codes, to obfuscate, to over-complicate. Over decades, a culture of being borderline fraudulent develops, a mythology that it's impossible to even know the costs upfront.
If I wanted to invent a machine that would cause prices to spiral out of control at the fastest possible rate, I don't think I could beat this.
> public education
By all means, I wish medical care could be as wonderful as public education. We could have the excellence of inner city Baltimore schools, coupled with the overabundance of service we see in California schools and the high levels of compensation of the average nationwide teacher salaries. Never mind the great outcomes that institution provides.