(Reuters) - CVS Health Corp, the second-largest U.S. drugstore operator, will pay $22 million to resolve a federal probe into whether two of its pharmacies in central Florida sold powerful, potentially addictive painkillers that were not prescribed for legitimate medical purposes.

The settlement was announced on Wednesday by U.S. Attorney A. Lee Bentley in Tampa, nearly three years after U.S. Drug Enforcement Administration licenses were revoked for the two pharmacies in Sanford, Florida, about 25 miles (40 km) northeast of Orlando.

These revocations were part of a crackdown in Florida on illegal sales of controlled substances, at the height of what Bentley called the state's "pill mill crisis."

DEA agents had found that the two pharmacies ordered roughly 3 million oxycodone pills in 2011, ranking 23rd and 37th nationwide among pharmacies in the distribution of such pills, and ignored red flags that the prescriptions they were filling were not legitimate.

In a regulatory filing, CVS said the settlement resolves all civil matters between the company, which is based in Woonsocket, Rhode Island, and the DEA in Florida. It also said it set aside enough money in prior fiscal periods to cover the accord.

CVS shares fell 43 cents to $99.81 in Wednesday trading.

By Jonathan Stempel

(Editing by Ted Botha)