A federal judge has thrown out a lawsuit filed by six states, including Iowa, asking the court to strike down a California law barring the sale of eggs produced by hens in cages that don’t meet the state’s minimum standards, the Associated Press reported last week.

U.S. District Judge Kimberly Mueller dismissed the suit, saying the states lacked legal standing to sue because they failed to show that the California law does genuine harm to their citizenry instead of just possible future damage to some egg producers.

“It is patently clear plaintiffs are bringing this action on behalf of a subset of each state’s egg farmers,” Mueller wrote in the decision, “not on behalf of each state’s population generally.”

She also ruled that the suit can’t be refiled or amended, though the states can appeal. Missouri Attorney General Chris Koster filed the lawsuit in February challenging the law that is set to take effect in January 2015. Nebraska, Alabama, Oklahoma, Kentucky and Iowa joined in March. The states contended the California law violates the interstate commerce clause of the U.S. Constitution by effectively imposing new requirements on out-of-state farmers.

The six states combine to produce 20 billion eggs a year, of which nearly 2 billion are sold in California. Koster contended Missouri farmers would have to spend about $120 million to remodel their cages to comply with California’s law or lose out on sales to a crucial market.

In a statement released when the lawsuit was filed, Koster said the case is “not just about farming practices” but about “whether elected officials in one state may regulate the practices of another state’s citizens, who cannot vote them out of office.”

California voters approved a 2008 ballot measure that required pigs, calves and egg-laying hens to be raised with enough space to allow them to lie down, stand up, turn around and fully extend their limbs.

California legislators later ex­­panded the law to ban the sale of eggs in the state from any hens that were not raised in compliance with its animal care standards.