Medicare funds medical residency (not the NIH and not the AMA). The 1997 balanced budget act passed by congress limited the expansion of new medical residency training.
Professional organizations have stronger incentives to increase their compensation through restricting supply instead of decreasing their compensation to help their customers.
The AMA is actually doing a great job at this recently compared to the ABA, where there have been too many lawyers graduating recently for insane salaries except at the top.
[0] https://www.npr.org/2018/03/09/592333771/severe-shortage-of-...