Part of the problem is the US education system seems to not be turning out enough people with quality educations, even when there isn't a shortage of of credentialed people. For instance, there are plenty of lawyers. Most of them don't make much money and leave the industry quickly. Yet it is difficult to find a highly qualified lawyer to handle difficult issues.
With medical professionals, there is simply a huge shortage. Same with researchers, engineers, etc.
My company hires H1B visas not because they are cheaper, but because we can't get anyone here to do the job at reasonable rates. Reasonable being new graduate hires start out at CPI adjusted rates to near top end in silicon valley.