GoodRx already does this somewhat with prescription medication, by getting pricing data on prescriptions from local pharmacies.
Perhaps, based on the GoodRx model, the opportunity is to improve price pressure on recurring procedures for patients who require ongoing dialysis treatment, dermatology care, physical therapy, etc. For emergency based care in hospitals, I still don't think it's a major net-win for consumers, as you don't care enough to ask about price when your leg is broken.
If I know in advance Hospital A is cheaper than and of the same quality as Hospital B, that could affect my decision around where to go for something like a broken bone. (Urgent, but not critical.)
Haven't broken a leg, so can't be sure whether I'd be functional - probably depends on how bad the break is :D
How that can be legal, I don't know.
(But if you're asking "why do we have such a crazy healthcare system," I have no answer.)