T-Mobile says it's on a mission to help customers by reshaping the U.S. wireless industry. But the company is now accused of hitting those same customers with hundreds of millions of dollars in bogus charges.

The Federal Trade Commission filed a lawsuit Tuesday alleging that T-Mobile (TMUS) earned a windfall in recent years from third-party merchants offering bogus text message subscriptions for things like flirting tips, horoscopes and celebrity gossip. Those charges frequently weren't authorized by customers. The charges were allegedly concealed on customers' monthly bills.

As many as 40% of those customers hit with these monthly charges sought refunds, a fact that the FTC says should have been "an obvious sign to T-Mobile that the charges were never authorized." The complaint alleges that the charges took place between 2009 until December of last year, and T-Mobile had documentation of high complaint levels as early as 2012.

"T-Mobile knew about these fraudulent charges and failed to stop them or take any action," FTC consumer protection director Jessica Rich said on a conference call with the media. The Federal Communications Commission is also investigating T-Mobile's alleged cramming, she added.

Related: T-Mobile offers unlimited music streaming

T-Mobile CEO John Legere fired back Tuesday, calling the FTC complaint "sensationalized," "unfounded and without merit." In a statement, Legere claims that T-Mobile stopped billing for premium texting services in 2013 and created a program for customers to receive full refunds. He called on the FTC to hold the nefarious text subscription services responsible -- not T-Mobile.

"T-Mobile is fighting harder than any of the carriers to change the way the wireless industry operates and we are disappointed that the FTC has chosen to file this action against the most pro-consumer company in the industry rather than the real bad actors," he said.

The FTC doesn't yet have precise estimates for the number of customers affected or the total amount of bogus charges. Those issues will be settled in court.

The FTC engaged in settlement talks with T-Mobile before Tuesday's announcement but failed to reach an agreement, Rich said. The agency hopes to secure refunds for all consumers affected.

The lawsuit comes as T-Mobile engages in an aggressive marketing campaign dubbed the "un-carrier" strategy.

The goal is to upend the mobile industry, and T-Mobile's been doing that by eliminating contracts, dropping international roaming charges and offering to pay competitors' customers $650 to switch over.

Speaking at a press event in Seattle last month, Legere spoke with disdain about the billing practices of larger rivals Verizon (VZ) and AT&T (T).

"They see everything as an opportunity to tell customers what to do and to gouge them," Legere said.

T-Mobile is itself in the process of finalizing a $32 billion merger with Sprint (S), according to reports last month. If approved by regulators, the deal would unite the nation's third- and fourth-largest carriers into a combined entity with subscriber numbers comparable to Verizon and AT&T.