The status quo might be more profitable for hospitals though.
The lack of doctors allows hospitals to charge more money for access to the ones they have. And right now the government foots the bill for training new doctors.
If they funded new residency slots they'd simultaneously increase their expenses, and reduce long-term revenues. Even if the resident's work is profitable by itself - in the sense of generating more in billings than the costs in salary, benefits, and teaching time - it could be bad for the hospital in a decade or two.
If the government simply ended the practice of funding residencies then hospitals and the rest of the medical establishment would be forced to come up with a new approach. Until then they're content to ride the gravy train.