The counties convinced the jury that the pharmacies played an outsized role in creating a public nuisance in the way they dispensed pain medication into their communities.
"The law requires pharmacies to be diligent in dealing drugs. This case should be a wake-up call that failure will not be accepted," said Mark Lanier, an attorney for the counties.
"The jury sounded a bell that should be heard through all pharmacies in America," Lanier said.
Attorneys for the pharmacy chains maintained they had policies to stem the flow of pills when their pharmacists had concerns and would notify authorities about suspicious orders from doctors. They also said it was doctors who controlled how many pills were prescribed for legitimate medical needs.
CVSHealth, Walgreen and Walmart said they will appeal.
Walmart said in a statement that the counties' attorneys sued "in search of deep pockets while ignoring the real causes of the opioid crisis — such as pill mill doctors, illegal drugs, and regulators asleep at the switch — and they wrongly claimed pharmacists must second-guess doctors in a way the law never intended and many federal and state health regulators say interferes with the doctor-patient relationship."
Walgreen spokesperson Fraser Engerman characterized the case as an unsustainable effort "to resolve the opioid crisis with an unprecedented expansion of public nuisance law."
The company "never manufactured or marketed opioids nor did we distribute them to the 'pill mills' and internet pharmacies that fueled this crisis," Engerman said in a statement.
A statement from CVS spokesperson Mike DeAngelis noted: "As plaintiffs' own experts testified, many factors have contributed to the opioid abuse issue, and solving this problem will require involvement from all stakeholders in our health care system and all members of our community."
Two chains — Rite Aid and Giant Eagle — already had settled lawsuits with the two Ohio counties.
Lanier said during trial that the pharmacies were attempting to blame everyone but themselves.
The opioid crisis has overwhelmed courts, social services agencies and law enforcement in Ohio's blue-collar corner east of Cleveland, leaving behind heartbroken families and babies born to addicted mothers, Lanier told jurors.
Roughly 80 million prescription painkillers were dispensed in Trumbull County alone between 2012 and 2016 — equivalent to 400 for every resident. In Lake County, some 61 million pills were distributed during that period.
The rise in physicians prescribing pain medications such as oxycodone and hydrocodone came as medical groups began recognising that patients have the right to be treated for pain, Kaspar Stoffelmayr, an attorney for Walgreens, said at the opening of the trial.
The problem, he said, was "pharmaceutical manufacturers tricked doctors into writing way too many pills".
The counties said pharmacies should be the last line of defence to prevent the pills from getting into the wrong hands.
They didn't hire enough pharmacists and technicians or train them to stop that from happening and failed to implement systems that could flag suspicious orders, Lanier said.
The committee of lawyers for the local governments suing the drug industry in federal courts called Tuesday's verdict "a milestone victory" and "overdue reckoning".
"For decades, pharmacy chains have watched as the pills flowing out of their doors cause harm and failed to take action as required by law," the committee said in a statement. "Instead, these companies responded by opening up more locations, flooding communities with pills, and facilitating the flow of opioids into an illegal, secondary market."
The trial, before US District Judge Dan Polster in Cleveland, was part of a broader constellation of about 3000 federal opioid lawsuits consolidated under the judge's supervision. Other cases are moving ahead in state courts.
Kevin Roy, chief public policy officer at Shatterproof, an organisation that advocates for solutions to addiction, said the verdict could lead pharmacies to follow the path of major distribution companies and some drugmakers that have reached nationwide settlements of opioid cases worth billions. So far, no pharmacy has reached a nationwide settlement.
"It's a signal that the public, at least in select places, feels that there's been exposure and needs to be remedied," Roy said.
The government claims against drugmakers, distributors and pharmacies hinge on state and local public nuisance laws.
Roy noted that courts haven't been consistent on whether those laws apply to such cases. "There's been a variety of different decisions lately that should give us reason to be cautious about what this really means in the grand scheme," he said.
Two recent rulings went against the theory. More cases are heading towards rulings.
Trials against drugmakers in New York and distribution companies in Washington state are under way. A trial of claims against distribution companies in West Virginia wrapped up, but the judge hasn't given a verdict.
Earlier in November, a California judge ruled in favor of top drug manufacturers in a lawsuit with three counties and the city of Oakland. The judge said the governments hadn't proven that the pharmaceutical companies used deceptive marketing to increase unnecessary opioid prescriptions and create a public nuisance.
Also this month, Oklahoma's supreme court overturned a 2019 judgment for $465 million in a suit brought by the state against drugmaker Johnson & Johnson.
Other lawsuits have resulted in big settlements or proposed settlements before trials were completed.
The jury's decision in Cleveland had little effect on the stock of CVS, Walgreens and Walmart, which all closed higher Tuesday on Wall Street.
- Associated Press writer Geoff Mulvihill in Cherry Hill, New Jersey, contributed to this report