The Department of Labor has the authority to set the rules governing the amount that foreign guest workers, who do the work that Americans won’t, will be paid, a federal judge in Philadelphia has ruled in a case that could cost employers $847 million.

U.S. District Judge Legrome D. Davis of the Eastern District of Pennsylvania held that Congress intended for the Department of Labor, with its intricate understanding of the labor market, to engage in the execution of the visa program through which employers can bring foreign workers to the country.