To Donald Trump, it seems, capitalism is less a matter of the market’s “invisible hand” than of his own presidential hand on the economic scales. Mr. Trump’s threat last week to bring a “major” lawsuitagainst pharmaceutical companies that produce FDA-approved pain medications not only tips the scale against Big Pharma, but undermines the rule of law.

A federal lawsuit would not, of course, be the first government case against the makers of prescription opioids. In 2014, Chicago and two California counties became the ?rst government entities to sue the drug companies for the public costs of the opioid-abuse crisis. Since then, hundreds of cities, counties, states, and Native American tribes have jumped on the bandwagon looking for big payouts from the drug industry. Today, there are close to 1,000 opioid-related cases pending in courts across the country, hundreds of which have been consolidatedbefore a single judge in Ohio.

The government plaintiffs seek billions of dollars in damages, purportedly to pay for the uptick in public spending on law enforcement, prisons, treatment, and social-welfare programs since the beginning of the opioid crisis.

Such lawsuits are a form of legalized extortion.

Countless legal products and private activities contribute to increases in government spending. Will the government next sue Anheuser-Busch for the economic costs of alcoholism? Can a case against Ford and GM to recoup the public cost of car accidents be far behind?

Spending money to address societal ills, both old and new, is what governments do. Suing companies into paying for public costs associated with the misuse of their products is a government shakedown.

Unfortunately, this abuse of our legal system is nothing new.

Government opioid lawsuits mirror the tobacco cases of the 1990s, in which 46 states sued cigarette makers for the public cost of smoking-related diseases. Not surprisingly, many of the state and local jurisdictions currently suing Big Pharma have hired the same plaintiff attorneys who made a fortune off the tobacco settlements.

The arguments made by the states against cigarette makers were legally weak. But to avoid infinite litigation, tobacco companies entered into a master settlement agreement that required them to pay hundreds of billions of dollars to the states.

But Mr. Trump and the politicians already suing the industry don’t care whether the cases have legal merit. They are playing a different game: making the cost of defending such lawsuits so exorbitant and unpredictable that the industry has little choice other than to settle.

For politicians, litigation is win-win: If it’s successful, it funds government largesse without raising taxes. If it fails, it still generates fawning publicity for politicians who “stand up” to the latest boogeyman.

What it won’t do, however, is solve the crisis.

After thousands of private attorneys take their cut of any settlement money, the government plaintiffs will no doubt apply the remaining funds to budget shortfalls or use them for pet projects. This is precisely what happened with the tobacco settlements: Only a tiny fraction of the billions of dollars that tobacco companies paid to state governments went to reduce cigarette smoking.

Ultimately, it is the consumer who bears the costs of these lawsuits in the form of higher drug prices, reduced access to pain medications for patients who need them, and less funding for the research and development of new medications and cures.

What’s more, these suits hurt our democracy. The constitutional doctrine of separation of powers mandates that courts stay out of the public-policy arena in deference to the political branches of government. It is the job of the legislative and executive branches to pass laws and regulations regarding the manufacture and distribution of prescription medications. Congress and the FDA are responsible for collecting relevant data and weighing the interests of various stakeholders before determining how best to regulate such drugs. The Department of Justice is responsible for prosecuting those who break the law by, for example, diverting prescription medications to the black market.

Courts, by contrast, are ill-equipped to weigh the costs and benefits of legal medications, develop federal drug-control policy, or impose new rules on the makers of prescription medications. But that is exactly what these lawsuits ask them to do.

Thankfully, some courts are starting to push back against regulation-by-litigation. In June, a federal district court in California rejected a similar lawsuit by the cities of San Francisco and Oakland against Exxon and other oil companies for the cost of infrastructure projects meant to mitigate the effects of climate change. In dismissing the case, Judge William Alsup reprimanded the cities for attempting to conscript the courts into making policy. It is not the role of the courts, Judge Alsup wrote, to “balance the social utility against the gravity of the anticipated harm.”

Nor is it the role of unelected judges to engineer a massive redistribution of wealth from the private sector to the public sector.

The Trump administration has, indeed, taken some important steps toward combating the opioid-abuse crisis. But, like most government litigation against unpopular legal products, Mr. Trump’s proposed civil suit against Big Pharma is nothing more than an opportunistic money grab and an attempt to regulate the private sector through the back door.