Medicare pays on a set scale for performance. If you have a heart attack, they pay a fee for the surgery and x days of hospitalization and x days of rehab. If the hospital gets you home in x-3 days, they make money. If the hospital fucks up and you get an infection and stay for x+10 days, they eat it.
Medicaid is a PPO that pays on a per procedure basis. Their rates suck, but they don't care about quality for the most part. There's a billing optimization process to maximize revenue for poor old people. (Some things are better billed to Medicare, others to Medicaid)
Private insurance pays for whatever they cover at a rate of y+z% over the Medicare rate. The patient gets the bill for whatever else happens.
Uninsured get whatever treatment is legally necessary. They patch you up, take a loss, kick you out and do it again when you come back.
(I would guess that Kaiser might be doing somewhat better since they're paid monthly but their finances aren't easy to find.)