I read an article in the past - I forget the source now, but I believe it was credible - about how American STEM PhD programs (and master's programs) admit a lot of qualified international students, e.g. from China and India, in order to help fill the skills gaps in the U.S., but an interesting phenomenon was that American medical schools don't act in the same way, effectively not admitting international students and preserving the acceptance slots for American students. If this is indeed true, why is that the case? Doesn't the United States have a skills gap in medicine and a shortage of medical doctors?
This may have changed but we studied cartels in college and the American Medical Association (AMA) was called a cartel by my professor.
In the US the AMA not only sanctions the medical schools but puts a count on how many students can be accepted. Since there are a limited number of slots competition is more fierce.
There is no external body limiting STEM or other graduate school departments.
STEM and other PhD can get grants as they are producing a product (thesis) that can be (and often is) sponsored.
In medical school the only product is medical training for the student. There is little to no incentive to sponsor a medical degree.
An important difference between graduate education in the arts and sciences (and engineering) and graduate education in professional schools (fields such as medicine, law, and business) in the US is that most graduate students in science and engineering are financially supported by teaching or research assistantships that cover tuition and pay a stipend for living expenses, while most students in the professional fields pay tuition (as much as $100,000 per year for medical school.)
Very few international students can afford to pay tuition for these professional programs.
Most of the US citizens in these programs take on substantial student loan debt with the expectation that they'll earn enough after graduation to pay off their debt. For students in medicine and business, this has worked fairly well.