Two of the biggest credit bureaus misled hundreds of thousands of people about the price and usefulness of the credit scores they sell, the government's consumer watchdog agency says.

The Consumer Financial Protection Bureau ordered TransUnion (TRU) and Equifax (EFX) to pay a total of $17.6 million in restitution to customers and $5.5 million in fines.

The companies offered credit scores for free or $1, then enrolled customers automatically in monthly paid subscriptions without clearly disclosing them, the CFPB said Tuesday.

TransUnion and Equifax were also accused of selling credit scores that were different from the scores used by lenders for evaluating borrowers.

About 700,000 TransUnion customers will be paid restitution. The CFPB did not have a figure for Equifax.

Related: Your credit score isn't what you think

The practices have been going on since July 2011 at TransUnion and between July 2011 and March 2014 at Equifax, the CFPB said. The agency said the companies will have to truthfully represent the usefulness of their credit scores in the future.

A spokeswoman for Equifax told CNNMoney that the company "implemented changes addressing the CFPB's concerns" after the agency started investigating the company.

"While Equifax does not believe it has violated any laws and has not admitted any liability, Equifax determined it was in its best interest to resolve the matter with the CFPB," the company said in a statement.

A spokesman for TransUnion told CNNMoney that the company was cooperating with the CFPB but did not admit wrongdoing.

The restitution includes $13.9 million from TransUnion and $3.8 million from Equifax.