Residents are poorly paid, but residency programs are expensive to operate and expand. The non-profit and public sector teaching hospitals which operate most such programs are generally doing better than small rural hospitals but they're still in a precarious state. They take losses treating a lot of uninsured and Medicare/Medicaid patients.