In 2018, when Mike DeWine was Ohio’s attorney general, he began investigating an obscure corner of the health care industry.

He believed that insurers were inflating prescription drug prices through management companies that operated as middlemen in the drug supply chain. There were concerns that these companies, known as pharmacy benefit managers, or P.B.M.s, were fleecing agencies like Medicaid, the government-run health insurance program for the poor.

Three years later, after Mr. DeWine became governor of Ohio, the state announced an $88 million settlement with one of the nation’s largest insurance companies, Centene.

The case led to a nationwide reckoning for the company, as attorneys general in one state after another followed Ohio’s lead, announcing multimillion-dollar settlements and claiming credit for forcing Centene to reform its billing practices.

On the surface, it appeared that these settlements, which now total nearly $1 billion, were driven by state governments cracking down on a company that had ripped off taxpayers.

But a New York Times investigation, drawing on thousands of pages of court documents, emails and other public records in multiple states, reveals that the case against Centene was conceived and executed by a group of powerful private lawyers who used their political connections to go after millions of dollars in contingency fees.