This is a real problem. My anecdote:
Several years ago I interviewed for a job with a software company that specialized in analytics. At the time I had almost ten years of enterprise java development experience. I sailed through all the interviews and was told I was by far the strongest candidate and they were about to make me a job offer. At final phase, HR director calls and says they want to send me an offer, they just want to know what my degree was in. I told them that while I went to school for computer science, I dropped out before completing (dot com bubble era) so I never finished my degree. After hearing that HR lady was like, "oh... lemme call you back" ... called back a few minutes later saying they were not able to extend the offer, even though I was the strongest candidate, because if they hired someone without a degree it would jeopardize their ability to hire H1-B workers. When I asked why, I was told it was because they use degrees as the primary indicator of qualified workers. If they hired someone who didn't have a degree, it would demonstrate that there really are more qualified workers in the US than they claim, and they would no longer be able to hire H1-B.
So, while it may not be that my job was directly taken by an H1-B worker (I don't know for sure if this was the case), my job went to someone less qualified because of H1-B bureaucracy.