I won't attempt to defend the hospital but even outside of healthcare, price gouging is almost always legal. There are only a few limited circumstances where it is banned in a subset of US states.
"Price gouging" is only legal when a contract is formed. A contract requires well defined consideration, as well as a meeting of the minds - neither is present when a person is not told an up front price (especially after asking), and is under medical duress.
It's better described as evidence of a contract. But I guess a signed piece of paper is merely evidence of a contract as well, despite being commonly referred to as "a contract".
But this isn't really relevant when discussing healthcare, because the problem is precisely with providers not dealing in specifics that would be necessary to create a printed receipt. It would be a terrible system if hospitals demanded full payment ahead of treatment and price gouged patients on the spot, but it would be significantly more legitimate than what we currently have!