There are time, as in emergencies, where the purchaser doesn't have the ability to shop around. But in general free markets work fine for food despite the fact that without food you'll also die. The problem is more that it's hard for the consumer to know the quality of what they're purchasing.
In countries where the consumer pays for their treatment they generally do get the prices up front, as in a restaurant. That's also how things used to work in the rest of the world before the rise of health insurance and national health services.