CVS Pharmacy Inc., which operates the largest number of retail pharmacies in the nation, has agreed to pay more than $77 million to settle charges that it illegally sold pseudoephedrine to methamphetamine traffickers, federal prosecutors said on Thursday.

Pseudoephedrine, found in over-the-counter cough and cold medications, is used in the manufacturing of methamphetamine.