A helpful link on this subject. Apparently, medical schools in the US are now allowing more graduates. Not sure about profitability of residency programs, but certainly not all hospitals are teaching hospitals and the latter are federally subsidized.