I see a lot of general anger against H-1B visas, so hear me out. There are broadly two kinds of Indians who work in the US legally (I will come to the illegal part later) under H-1B visas.
[1] The first is typically graduates from elite Indian engineering institutions (Indian Institutes of Technology, or a few other institutes) who have either gotten a job offer from a US firm for their US office straight out of college, or have come to the US for graduate school and are now entering the workforce. These are, in an overwhelming majority of cases, NOT cheap labour. They are hired at market rate (sometimes even higher, because they typically have strong profiles), they compete with the rest of the student and larger labour pool and get these jobs based purely on merit. For reference, I have plenty of friends who are in this category (I am too), and all of us get paid competitive market salaries. We are also not beholden to any firm and are pretty free to switch jobs if we desire. A lot of us have paid for graduate school in the US too, so it's not like we are just somehow freeriding. This is the kind of crowd you typically encouter in the Bay Area.
[2] The second category typically consists of people who don't have a stellar educational background, and are mostly hired in India by companies like Infosys, TCS, Wipro et al. for typically very low salaries (say 1/4th or 1/3rd of what a Googler would get in India). They mostly work on outsourced projects that come from other companies (both in India and outside). Often, these workers are then transfered to the US, where they work as vendors for companies such as Microsoft. They are technically employees of TCS or Wipro or whatever (which have branches in the US), and are on the payroll of these companies, but work for companies like Microsoft. This pool of workers is indeed cheap labor for the big cos because they can a) skimp on stuff such as insurance costs b) typically have to pay less anyway c) the low salary is still pretty high compared to what the worker would have otherwise been able to command in India, d) the worker has relatively lower job mobility because their resumes are probably not as 'employable' as Category [1]
Like it or not, [2] far outnumbers [1]. I don't remember the link right now, but these companies apply for in the order of 1000 H-1B visas every year. Most startups etc, for example, apply for a few or in the order of tens at best.
The illegal bit is of course what a few other commenters wrote—there are these 'consulting firms' which will apply for H-1B on your behalf (you pay them $5K or whatever). If you get through the lottery, you can now move to the US on H-1B. You don't have an actual job though you are on the consulting firm's payroll. You then transfer money to them under the table, which they pay back to you as 'salary' because you are on their payroll after all. In the meanwhile, they try to find a job for you. If they can find a job you will then work wherever they set you up and they take a cut of your salary. This is typically done by people who want to accompany their spouses to the US but don't want to be on H-4 visas which don't let you work.