Telephone giants Verizon and Sprint will pay almost $160 million in fines from the US government for imposing unauthorized charges on its customers. The two companies agreed to settle the matter in the wake of federal investigations.

The settlement with Sprint and Verizon follows a lawsuit filed by the Consumer Financial Protection Bureau (CFPB) in New York federal court, which charged the telecommunications companies for processing charges for third parties, and for violating the Dodd-Frank Wall Street Reform and Consumer Protection Act’s prohibition of unfair practices.

READ MORE: Sprint to pay $15mn for overcharging feds as it wiretapped its customers

Specifically, the government argued the companies allowed third parties to illegally charge people through their billing system, through a practice called “cramming,” and then profiting from the charges by as much as 35 percent, behavior which victimized millions of people

“Sprint and Verizon had flawed billing systems that allowed merchants to add unauthorized charges to wireless customer bills,” said CFPB Director Richard Cordray in a statement. “Consumers bore the brunt of those charges and ended up paying millions of dollars while the companies reaped profits. Today’s actions will put $120 million back into the pockets of harmed consumers and require these companies to improve their billing practices going forward.”

The total fine comes to $158 million – Verizon will pay $90 million while Sprint will pay out $68 million – and includes additional fines of $38 million in federal and state charges. Most of the fines will go towards refunds to customers. The companies also agreed to provide better oversight of third-party billing.

READ MORE: Not yet worldwide: 3bn web surfers, but half global population still offline

The theft occurred when people were targeted online through ads that, once clicked on, brought them to websites asking for their cellphone numbers. Merchants then tricked people into providing their numbers to get “free” digital content only to be charged for it later, the bureau said. In other instances, the merchants fabricated charges without delivering any goods or communication with consumers.

“The monthly charge for these third-party premium text messaging services ranged from $0.99 to $14.00, but typically were $9.99 per month. Verizon retained 30 percent or more of each third-party charge that it billed, while Sprint received approximately 35 percent of collected revenues for each of its third-party charges,” said the Federal Communications Commission in a statement.

Both Sprint and Verizon use third-party billing companies, neither of which required customers to opt into third-party billing. Instead, people were automatically enrolled without their consent. Customers were unware that third parties could place charges on their bills, and despite the companies offering them third-party protection, they made no use of it because they weren’t aware of the practice.

The CFPB said the telecomm companies ignored customer complaints, didn’t bother to track the complaints and failed to provide refunds to consumers.

READ MORE: FCC is a 'referee' for open internet, not regulator - Wheeler

The companies received up to a 35 percent cut of the gross revenue from these charges, which were incurred from about 2004 through 2013, the CFPB said.

"Well before any government action, Verizon Wireless stopped allowing companies to place charges for premium text message services on customers' bills," Verizon spokeswoman Debra Lewis said in a statement released to CBS. "Customers who believe they were billed improperly for these services may seek a refund."

The lawsuit was filed in the Southern District of New York in December 2014. On Tuesday, CFPB filed a new complaint as well as a proposed settlement in the District of New Jersey to address Verizon’s unlawful conduct of “cramming.”

There have also been similar telecom settlements in New York. AT&T in October of 2014 settled similar allegations for $105 million and T-Mobile, in December 2014, settled for $90 million