Sure funding is limiting residency slots, but so are both practical issues and specialty groups.
First the practical issues: Most major hospitals that provide the volume and diversity of pathology needed to support residents already have them. Adding additional residents to already saturated programs diminishes the quality of training for everyone, while creating new programs at marginal hospitals may provide sub-standard training.
Secondly the specialty supply issue: Even if our hospitals could support more derm, neurosurgery, ENT, and Ortho residencies, do you think those specialty groups would support opening more programs? This increases the supply of said docs, reducing job offers, salary, etc. To be blunt, it is good for docs in a given specialty to have a shortage. The only downside is when said shortage creates a gap for someone to try to enter your turf (optometrists into eye surgery, NAs into anesthesia, etc.), but that is a long-term issue, while getting paid more due to being in demand is a short term issue. Guess which one wins? And while we could add more primary care residencies, where most of the "shortage" (aka maldistribution) lies, its not like US residents are filling up the current primary care slots.
While limiting spots sucks when your on the outside looking in, its great when on the inside looking out. Those on the outside aren't looking to pour more money into residency training, and those on the inside are happy being in demand. With no real lobby on either side to boost residency slots, its just not going to happen.
Finally, the US doctor "shortage" is not an issue that will be solved by supply alone. The issue isn't really that there aren't enough doctors, the issue is that there aren't enough doctors that want to live in crappy areas and accept medicaid (aka crappy reimbursement)
Tools like boosting loan-forgiveness and medicaid/care reimbursement in underserved areas will work much better then boosting overall supply.