The "Fair Share" law required employers with more than 10,000 employees to spend the equivalent of 8 percent of payroll on employee healthcare. Wal-Mart is the only retailer in the state large enough to be affected.
U.S. District Judge Frederick Motz said the law would hurt Wal-Mart by imposing the administrative burden of tracking benefits in Maryland differently than in other states.
Attorneys for the Retail Industry Leaders Association, which filed the lawsuit on Wal-Mart's behalf, argued that the law unfairly applied to only one company and violated federal ERISA laws, which limit state jurisdiction over the benefits companies provide their employees.
The attorneys representing the state of Maryland said the law does not mandate benefits because the company is free to fulfill its obligation in numerous ways such as employee health clinics -- or simply paying the penalty.
The verdict marks another setback for the national Fair Share campaign, spearheaded by unions, which has managed to get similar legislation introduced in other states, but not passed.
Proponents of the bills say they are a way to prevent companies from taking advantage of state Medicaid programs, which insure many employees of Wal-Mart and other large companies.
Opponents argue the bills are bad for businesses that provide as much coverage as they can afford.
When the law was passed, Wal-Mart said most of its employees either took advantage of company health plans or were already covered by other means.
Scarlett Johansson steps out with fiance after pregnancy reveal
Jessica Simpson shares three-way kiss with friends in photo