I can't speak about other fields, but general surgery residents are underpaid in my opinion. General surgery residents work 70-90 hours a week, and as junior residents, a lot of the work is low-level scut. Education consists of 1 hr of M&M conference, 1 hr basic science, and maybe 1 hr of grand rounds. That's 3 hrs per week. On top of that you get some teaching in the OR if you are lucky enough to get a case, which is infrequent as junior residents. The teaching on the floor is done by upper level residents, mid-levels, the social worker, pharmacist, and whoever else you seek information from.
A junior surgery resident earns about 50k for 80 hrs per week.
A surgery PA or NP earns about 80k for 40 hrs per week.
To put it another way, a surgery mid-level earns about 3.2x per hour more than the junior surgery resident, while working better hours with no overnight call. Extrapolate a mid-level salary to resident hours, and you are looking at 160k, without accounting for any over-time or weekend adjustment.
I think it is reasonable to say that by at least 4-6 months into internship, most residents can do a pretty similar job to experienced mid-levels in terms of scut and logistics of the hospital. So we provide equal (and probably greater) value to the hospital compared to a mid-level at this point.
In other words, one can say that you are looking at a "tuition" of 110k per year, for 3 hours of education per week. Things become more complex the further you go in training, because our management complexity and skill begin to distance themselves from that of a mid-level, but our education in the OR also increase significantly. Upper levels also have greater responsibility for teaching junior residents and medical students, which is not reimbursed. But looking at internship and maybe PGY2, we are very underpaid.