It hardly needs saying that immigration policy should not undermine Americans’ jobs, wages or working conditions. The problem is that what some companies want — cheap, exploitable, disposable labor — is exactly what the system can be twisted into giving them.

Former workers at Walt Disney World in Orlando or at Southern California Edison, the power utility, can tell the story. Those two companies recently laid off hundreds of tech employees, who were replaced by temporary workers recruited by outsourcing firms based in India.

These are only two of many troubling episodes involving the H-1B program, which provides up to 85,000 visas a year to foreigners, mainly highly skilled technical workers. The program was created to allow companies to fill gaps in their work force with specialized employees they cannot find in the United States. But the law has loopholes, and companies here and overseas ruthlessly exploit them. A huge industry has risen to meet labor demand in the information-technology sector, with the imported workers being employees of the outsourcing firms.

On Thursday the Labor Department announced it was investigating two of the largest companies that supply H-1B workers, Infosys and Tata Consultancy Services, based in India. Senators including Jeff Sessions, Republican of Alabama, and Dick Durbin, an Illinois Democrat, asked for the inquiry after reports that Southern California Edison turned to Infosys and Tata for H-1B workers even as it was laying off 540 workers, many of whom said they had to train their replacements. The Times recently reported a similar story at Disney, which contracted with HCL America, a branch of an Indian outsourcer, and laid off 250 workers. Some workers said they were asked to stay on to train the newcomers who took over their jobs.