Last year, thousands of American companies won permission to bring a total of more than 150,000 people into the country as legal guest workers for unskilled jobs, under a federal program that grants them temporary work permits known as H-2 visas. Officially, the guest workers were invited here to fill positions no Americans want: The program is not supposed to deprive any American of a job, and before a company wins approval for a single H-2 visa, it must attest that it has already made every effort to hire domestically. Many companies abide by the law and make good-faith efforts to employ Americans.

Yet a BuzzFeed News investigation, based on Labor Department records, court filings, more than 100 interviews, inspector general reports, and analyses of state and federal data, has found that many businesses go to extraordinary lengths to skirt the law, deliberately denying jobs to American workers so they can hire foreign workers on H-2 visas instead…

At the same time, companies across the country in a variety of industries have made it all but impossible for U.S. workers to learn about job openings that they are supposed to be given first crack at. When workers do find out, they are discouraged from applying. And if, against all odds, Americans actually get hired, they often are treated worse and paid less than foreign workers doing the same job, in order to drive the Americans to quit. Sometimes, as the government alleged happened at Hamilton Growers, employers comply with regulations by hiring Americans only to fire them en masse and hand over the work to foreign workers with H-2 visas.

What’s more, companies often do this with the complicity of government officials, records show. State and federal authorities have allowed companies to violate the spirit — and often the letter — of the law with bogus recruitment efforts that are clearly designed to keep Americans off the payroll. And when regulators are alerted to potential problems, the response is often ineffectual.