After graduating college I joined a company that paid generally below-market for everyone and had a significant number of H-1B employees and contractors.
The benefits were legendary but the pay was 20-30% lower than what was around.
I don’t have evidence of wrongdoing but I’ve occasionally wondered if it was some kind of scheme.
“Legendary” benefits (especially healthcare) are extremely expensive. It’s plausible that the average total compensation was the same, or even more, than other companies. The trick is that not everyone gets the same value from those benefits.
The compensation is only measured in terms of salary (and maybe bonus).
Stock compensation is completely ignored. Since stock compensation can be a large fraction if not the majority of the compensation, this means that many H1-Bs may be underpaid compared to their coworkers, while appearing to the government to be the highest paid in that company and job role.
The other ignored aspect is effective hourly pay. Software engineers are nearly always exempt employees, so they don't receive hourly pay. But a manager can demand more from H1Bs, even if it would mean work during nights or weekends, and there's little the H1B can do. Local employees can more easily change jobs if that happens, and moreover, the threat that they can change jobs disincentivizes such abuse.
It's a bit of a catch-22 because if you add enough lower compensated employees you shift the local median lower. If "everyone" in the local area is hiring more cheaper H-1Bs that gives you a chance to hire even more H-1Bs for even cheaper. Averages can be a fun game that way.
Even if you try to pin it to the median that does not include H-1Bs, you still are letting the market compete on labor cost and that competition can still affect the local median. Companies decide all the time that they could hire, for example, 2 H-1Bs for the cost of one "senior" local developer, encouraging that local developer to maybe only ask for 1.5x "an H-1B" to remain competitive in that market. Iterate that enough in hiring decisions and companies still have more control of that local median than labor does.
I don't know if there is a "fair" way to set the cost of labor for an H-1B, but "local median" or any other average-based math is probably not it.