It was usually related to them recruiting a certain specialist or acquiring a team at another company. But the only way to get these people visas was to post the jobs publicly and hide them as much as possible. They did this by the hundreds, and it wasn't really a cost saving measure - if you are trying to get anybody in particular from Microsoft or Amazon and they are already here on a Visa, you have to go through the process all over again to sponsor them.
So it was less about racism and more about hoops to jump through to hire someone that you have already basically hired. If you've ever had experience with how a government RFP works, maybe don't throw rocks from glass houses.
Is it unfair? Maybe. But in my opinion anything is fairer than our country's evil immigration requirements.