Makers of generic drugs cannot be sued for not warning patients of the drugs’ dangerous side effects, the Supreme Court ruled Thursday, even though brand-name manufacturers can be found liable.

A five-member majority of the court recognized that it “makes little sense” to bar suits against generic drug-makers while allowing them against brand-name manufacturers, but said federal law gave the justices no other choice.

The ruling brought a sharp retort from the court’s liberals.

“As a result of today’s decision, whether a consumer harmed by inadequate warnings can obtain relief turns solely on the happenstance of whether her pharmacist filled her prescription with a brand-name or generic drug,” wrote Justice Sonia Sotomayor, who noted that 75 percent of prescriptions are filled with generic drugs.

“The court gets one thing right: This outcome ‘makes little sense.’ ”

The ruling involved two women — Gladys Mensing and Julie Demahy — who sued Pliva and other generic drug manufacturers in state courts in Louisiana and Minnesota over the labels for metoclopramide, the generic version of Reglan.

The two women alleged that the drug, used to treat gastric problems, led to a severe neurological movement disorder called tardive dyskinesia. At the time, none of the generic drug’s manufacturers and distributors made any effort to include warnings on the label about extended use of the medication.

But Justice Clarence Thomas said the case highlights a conflict between state and federal laws. The state statutes require drug manufacturers to warn about new information on dangerous side effects, but federal regulations require generic drugs to carry the exact same label information as the drugs they imitate.

“State law imposed a duty on the manufacturers to take a certain action, and federal law barred them from taking that action,” Thomas wrote. Federal law must take precedence, he said, and the women’s suits were barred.

Thomas drew a distinction from the court’s 2009 decision in Wyeth v. Levine , in which the court ruled 6 to 3 that brand-name drug-makers were liable in “failure-to-warn” suits filed under state product liability law. In that case, Thomas said, federal regulations allowed Wyeth “of its own volition to strengthen its label in compliance with its state tort duty.”

Thomas recognized that the distinction would be unsatisfying to the women: “Had Mensing and Demahy taken Reglan, the brand-name drug prescribed by their doctors . . . their lawsuits would not be preempted.”

But he added: “It is not this court’s task to decide whether the statutory scheme established by Congress is unusual or even bizarre.” Joined by Chief Justice John G. Roberts Jr. and Justices Antonin Scalia, Anthony M. Kennedy and Samuel A. Alito Jr., he noted that Congress and the Federal Drug Administration could “change the law and regulations if they so desire.”

Sotomayor said the problem was the court majority, not lawmakers or agencies: “Today’s decision leads to so many absurd consequences that I cannot fathom” it is what Congress intended, she said.

Just because the manufacturers cannot add warnings on their own “does not mean that federal law permits them to remain idle when they conclude that their labeling is inadequate,” Sotomayor wrote. The companies should be protected from suit only if they tried to alter the labels and the FDA did not allow it, she said.

She was joined by Justices Ruth Bader Ginsburg, Stephen G. Breyer and Elena Kagan.

Thomas said similar cases would be “rare,” because harmful side effects are generally known by the time generic drugs come on the market.

But Louis Bograd of the Center for Constitutional Litigation, who argued the case, said the common use of generics means that “three of four patients in America has just lost the right to sue for inadequate warnings.”

The case is Pliva v. Mensing.

‘Data-miner’ protection

Sotomayor joined conservative justices in another case the court decided Thursday involving drug companies, in which the justices ruled that a Vermont law forbidding the sale of prescription data for marketing purposes violates the First Amendment.

Kennedy wrote the 6 to 3 opinion saying states may not prohibit drug manufacturers and “data-miners” from using prescription records from doctors to market new drugs. The practice allows drug companies to target their new products to doctors who often prescribe the old drugs.

Vermont cited a need for confidentiality — although patient information is not included — and to combat what it called an “imbalance” in the “marketplace of ideas” by companies who push expensive new drugs instead of cheaper, generic drugs.

“It can be assumed that these interests are significant,” Kennedy wrote. “Speech in aid of pharmaceutical marketing, however, is a form of expression protected by the Free Speech Clause of the First Amendment.”

Kennedy added that commercial speech “has great relevance in the fields of medicine and public health where information can save lives.”

The Pharmaceutical Research and Manufacturers of America and three companies that sell the information challenged the Vermont law. There are similar restrictions in Maine and New Hampshire.

Breyer, joined by Ginsburg and Kagan, said the law “adversely affects expression in one, and only one, way” — depriving the companies of using government-generated data that could help them “create better sales messages.”

He added: “In my view, this effect on expression is inextricably related to a lawful governmental effort to regulate a commercial enterprise.”

Breyer said he worries that the decision “opens a Pandora’s box of First Amendment challenges to many ordinary regulation practices that may only incidentally affect a commercial message.”

The case is Sorrell v. IMS Health.