Target has agreed to pay nearly $3 million to resolve allegations that it violated the federal and Massachusetts state law by submitting claims in violation of rules against Medicaid prescriptions being automatically refilled.

The settlement also means hundreds of thousands of dollars for a former Target pharmacist in the Twin Cities who blew the whistle on the practice with the lawsuit he filed in 2015 in federal court in Minnesota.

Along with at least 20 other states, including Minnesota, Massachusetts bars pharmacies from automatically refilling prescriptions paid for by Medicaid without an explicit request from the beneficiary for each refill.

Target pharmacies, according to the complaint, knowingly and routinely enrolled MassHealth's low-income beneficiaries in the company's auto-refill program and billed MassHealth for prescriptions. This prohibited practice continued from 2009 to 2015 until Target sold its pharmacy business to the CVS national chain.

"This policy provides an important control against wasted or unnecessary prescriptions that are reimbursed by taxpayer funds," read a Tuesday statement from the U.S. Attorney's Office in Minneapolis, where Target is based.

Despite the hefty payout, Target said it continues to deny the allegations, yet cooperated with the government investigation.

"We are satisfied that this issue is now resolved," said company spokeswoman Danielle Schumann.

The federal government will receive $1.5 million from Target and the state of Massachusetts about $1.46 million.

The lawsuit was brought by former Target pharmacist Ryan Mesaros under the federal False Claims Act and Massachusetts law. The government often relies on whistleblowers to bring fraud schemes to light that might otherwise go undetected. The act allows private parties to sue on behalf of the government for false claims and to share in any monetary recovery.

In this case, Mesaros will receive $570,000 from the federal government and his attorney, John Klassen, $230,000 from Target for his work. The payouts are subject to normal taxation.

Mesaros left his Target pharmacy in the Twin Cities before he sued and remains working as a pharmacist, Klassen said.

Speaking on behalf of his client, Klassen said that Mesaros "is happy to have this resolved and have it benefit the taxpayers of the United States and Massachusetts."

The states of Minnesota, New York and Virginia also had been parties in the suit. However, those states declined to pursue the case while Massachusetts remained and offered "the clearest violations" by Target, Klassen said.

The settlement "demonstrates our ongoing commitment to ensuring compliance with rules that are specifically designed to protect taxpayer funds and prevent wasted medications," U.S. Attorney Erica MacDonald said in a statement announcing the resolution of the suit.

Massachusetts Attorney General Maura Healey said that "unauthorized automatic refills can result in inappropriate prescription drug use and wastes taxpayer dollars. This settlement will bring money back to our state and will help ensure that our health care resources reach those who need them the most."

Paul Walsh • 612-673-4482