It's because in addition to the reimbursement, hospitals are paid a bonus fee by US taxpayers called a DSH to subsidize the subsidies. This serves to incentivize providers not to drop Medicare/Medicaid patients and also covers up the losses incurred.