CHICAGO (Reuters) - A sweetened beverage tax will take effect in Chicago on Wednesday after an Illinois judge threw out a lawsuit by retailers that argued the measure was vague and unlawful.

Cook County, which includes Chicago and surrounding suburbs, joins a growing number of localities across the United States that have adopted measures to cut consumption of sugary drinks for health reasons, including Seattle and San Francisco.

Cook County Circuit Court Judge Daniel Kubasiak decided in the county’s favor on Friday, about a month after he had halted implementation of the penny-per-ounce tax in response to the lawsuit by the Illinois Retail Merchants Association.

“We believed all along that our ordinance was carefully drafted and met pertinent constitutional tests,” Cook County Board President Toni Preckwinkle said in a statement released after the ruling.

The retailers had argued the tax was unlawful because it exempted custom-made sweetened beverages, such as coffee drinks made in a cafe, and only taxed pre-made beverages, such as sodas, sports drinks and flavored water.

In his order on Friday, Kubasiak agreed with the county that there was a significant distinction between taxing the two types of sugary beverages.

County attorneys had also argued that taxing custom-made beverages would put an excessive administrative burden on the county, and that taxing widely available pre-made beverages would be more effective in improving public health.

Preckwinkle said in the statement that the county, which passed the tax in November, lost at least $17 million in revenue in the weeks in which the measure was delayed.

Kubasiak said in his order that he was aware of the county’s “budgetary turmoil” as a result of the revenue loss but that it did not factor in to his decision making. “The Court is not party to the County’s budget matters and is not moved by its public airing of those matters,” he said.

In response to the plaintiffs’ claims that the technology needed to collect the tax would not be ready for quick implementation, Preckwinkle said the retailers should have been prepared to collect the tax a month ago.

David Ruskin, an attorney for the retailers’ association, said the plaintiffs are considering an appeal.

“We are disappointed with today’s ruling,” Rob Karr, president of IRMA, told reporters. “I can only imagine the outrage felt by consumers.”