Since 2005, drug companies have been dogged by accusations that they manipulated a key benchmark known as “average wholesale price” so that they could overcharge state and federal Medicaid programs for prescription drugs. State attorney generals picked the fight, and in some cases lined up the help of plaintiffs firms chasing a contingent fee. Class action lawyers got in on the action, too. The cottage industry of AWP litigation is still going strong, but the endgame seems to be nearing. Case in point: The country’s largest drug wholesaler, McKesson Corporation, reached a deal on Friday that will resolve much of its remaining AWP litigation woes.

New York Attorney General Eric Schneiderman announced on Friday that McKesson has agreed to pay $151 million to 29 states and the District of Columbia to resolve claims that it overbilled state health insurance programs for more than 1,400 brand name drugs between 2001 and 2009. McKesson, represented by Morrison & Foerster, will not admit any wrongdoing. Prosecutors in New York and California led the negotiations, so those states will get the largest slices of the settlement ($64 million and $24 million, respectively). You can view the settlement agreement McKesson reached with the California AG here.

A pharma industry consultant named David Morgan, who was hired by drug companies to audit its drug pricing information, brought a False Claims Act case against McKesson in U.S. district court in Newark in 2005 on behalf of the U.S. government and several state attorney generals. Morgan, who was represented by the Short Hills, N.J., firm Stone & Magnanini, alleged that McKesson provided false AWP information to First DataBank, the publisher of drug prices that most state health care programs use to determine reimbursement rates for drug companies.

Morgan’s case stalled for years while AGs contemplated whether to settle with McKesson or test their luck in court. A group of about ten state AGs have been leading the charge, not just against McKesson, but also against more than one hundred drug companies. As we recently reported, the Alabama firm Beasley Allen has gone four for four representing the Alabama AG in AWP jury trials, winning verdicts against AztraZeneca, Novartis, GlaxoSmithKline, and Sandoz worth a combined $400 million. But all of those verdicts have been tossed on appeal. Meanwhile, the DOJ and state AGs have struck dozens of settlements with drug companies totaling more than $2 billion.

McKesson added to that tally in April, striking a $190 million deal with the Department of Justice to resolve Morgan’s federal claims. And on Friday, it agreed to pay $151 million to the AGs. Two states that have been aggressively taking AWP cases to trial, Illinois and Michigan, participated in the settlement, suggesting that McKesson’s AWP woes are nearing a end. The company has already brought an end to AWP-related class action litigation, thanks to a $350 million settlement reached in 2008.

Morrison & Foerster partner Ryan Hassanein, who represents McKesson, declined to comment.

Editor’s Note: An earlier version of this story incorrectly stated the amount that New York  would receive under the settlement. We regret the error.