I think we can both agree that jobs are a market place, with the employer offering compensation of $X in exchange for that someone to do a job for them. That X has many components, from take home $ to health care benefits, to vacation policy, to prestige, to cost of living.
So when a person has multiple offers of employment, they pick the offer that best meets their needs and goals.
Let's use a made up example, lets say Bob has two offers of employment for $100,000 per year in annual salary. One is from a startup which can't afford to provide healthcare but they can provide equity (stock options), and one is from BigCorp with provides healthcare but no equity (I realize that as a non-US citizen it may be 'weird' to think that you have to pay for your own health care but its a big part of the compensation picture here.) Now if Bob is a young single person in good health, they may feel that the equity offered by the startup is potentially extra income, and the healthcare offered by BigCorp is a "waste" because they don't expect to use it during their employment. So they take the startup job. But if they were perhaps a bit older, or maybe had a family, or spouse who required expensive prescription medication, they might lean to the 'sure thing' of benefiting from the health care coverage as opposed to paying that out of their take home pay and only "maybe" making something on the equity.
So can you see how Bob might consider the "value" of health care or stock options differently depending on their family situation and/or health?
So if you are a trying to immigrate, how do you measure the value of that? Given an offer of $X for a job in the United States, what salary $Y would it take to keep someone home and not immigrating? Adding to the complexity, what if there isn’t even a single job available where you live? (some places such as Spain have reported huge unemployment numbers for everyone) If there is no alternative then the value might be “any” job at “any” price is better than no job.
What Google, Sun, and NetApp all found, and they have a lot of data on this stuff, is that on average someone who was seeking to immigrate would accept a salary that was about 25% lower than what it would take to hire an equally qualified engineer that was already living in the US. I've heard from folks at Oracle that they use 50% but that would be like Oracle. This discrepancy in salary requirement stems from the fact that candidates wanting to immigrate "value" the chance to live and work in the US, people already living and working in the US don’t have that perspective.
So for the cost of processing an H-1B visa, a company in the US can hire an engineer and save money on salaries. Further the reduced salary is paid over years so the savings are multiplicative, whereas the cost of an immigration attorney is often less than the difference of 1 years salary.
I’ll assert here that I don’t think there is anything particularly "evil" about this, the candidate is getting something they want (a visa to live and work in the US) and the company is getting what they want, the most engineer per $ spent. Once engineers are living in the US they often switch jobs as soon as their visa status allows it, and get a big jump in salary. Companies like Google and Facebook want more H1B visas because everyone they hire they get at a discount. And any jobs they have to fill when the visas run out they have to fill at "list price." It is often called a 'tech shortage' but it really isn't anything of the sort. Its an effort to keep the salaries paid down. That makes running the business easier (and more profitable).