In order to comply with federal drug regulations, CVS Pharmacy Inc. employed a new automated system three years ago to keep tabs on the sale of one of methamphetamine's main ingredients, pseudoephedrine, that is often found in cough and cold remedies.

The program known as "Meth Tracker" had one glaring flaw — it didn't account for people scooping as much medicine as they wanted in a given day, court documents show.

Although some store employees in Southern California and Nevada questioned if large amounts of pseudoephedrine flying off the shelves were being used for making meth, CVS management didn't investigate immediately and later changed its sales practices only after it became aware of a federal investigation, according to the documents.

On Thursday, the nation's largest operator of retail pharmacies announced it had agreed to pay $75 million in fines for allowing repeated purchases of pseudoephedrine that led to a spike in Southern California drug trafficking.

CVS will pay what federal prosecutors said was the largest civil penalty ever assessed under the Controlled Substances Act as well as forfeit about $2.6 million in profits earned from the sales of pseudoephedrine.

Authorities said CVS didn't provide enough safeguards to monitor how much pseudoephedrine a customer was buying, and the company violated the regulations in Arizona, Georgia, California, Nevada, South Carolina and possibly 20 other states.

"CVS knew it had a duty to prevent methamphetamine trafficking," said U.S. Attorney Andre Birotte Jr. "But it failed to take steps to control the sale of a regulated drug used by methamphetamine cooks as an essential ingredient for their poisonous stew."

The company was expected to pay the $75 million fine by Friday. The remaining forfeiture is due within 30 days.

Thomas Ryan, chairman and CEO of parent company CVS Caremark, said the company unacceptably breached its policies and has worked to fix the problem.

"To make certain this kind of lapse never takes place again, we have strengthened our internal controls and compliance measures and made substantial investments to improve our handling and monitoring of (pseudoephedrine) by implementing enhanced technology and making other improvements in our stores and distribution centers," Ryan said.

Federal agents began investigating CVS in 2008 after the arrest of several people in Southern California for unlawful possession of pseudoephedrine with the intent to manufacture meth. They said those people had bought large amounts of the ingredient from CVS stores in the region.

Investigators learned CVS had committed thousands of violations of a federal law limiting the amount of pseudoephedrine a customer can buy in a day. Although the pharmacy chain created an automated system known as Meth Tracker to record individual sales, it didn't prevent multiple purchases by someone on the same day, authorities said.

As a result, federal authorities in Southern California saw an increase in meth production. In Los Angeles and Orange counties, so-called "smurfers," who traveled from store to store picking up pseudoephedrine, inundated CVS locations. In some locations, buyers would clear store shelves of cough and cold medicines.

"Smurfers" knew to frequent CVS and not other pharmacies because of the company's oversight issues, authorities said, noting customers could buy a bottle of cold medicine for $10 and sell it to meth manufacturers for $25.

Between September 2007 and November 2008, CVS became one of the largest suppliers of pseudoephedrine to meth providers in Southern California, authorities said.

"CVS did not set out to be part of the meth trafficking trade but they made a poor decision," said Assistant U.S. Attorney Shana Mintz. "Rather than choosing to over-comply like their competitors did, they knowingly under-complied with the law."

Over a 10-month period in 2008, sales of products containing pseudoephedrine increased more than 150 percent in Los Angeles County, compared with the same period in 2007, authorities said.

"We know those sales were not your general customer who had a cold," Mintz said. "Some people were making 10 purchases at a time. Suppliers couldn't keep up with the demand."

CVS has more than 7,100 stores in the U.S.