What are you talking about? Residents earn a salary (just google "XYZ university resident salary" to find it...). Medical school (which is prior to residency) is where the debt gets heaped on.
I don't know the most about this field and you're right, a bunch of hospitals do pay. That's cool.