T-Mobile will pay $40 million to the U.S. Treasury to settle accusations that it failed to improve call delivery for rural customers.

The Federal Communications Commission announced the fine on Monday, after an investigation showed a "practice of injecting false ring tones" into hundreds of millions of calls. The FCC opened the investigation after T-Mobile callers were unable to reach consumers served by three rural carriers in Wisconsin, even though T-Mobile said it had "resolved" the issue.

The FCC has been trying to improve rural connectivity for years, encouraging users to report periods of "dead air" after dialing, choppy or echoing voice quality, or hearing "10-20 rings even though you are reasonably sure someone should be there to answer."

In 2015, Verizon paid $5 million to address similar issues. The FCC said T-Mobile's latest fine is the sixth settlement related to rural connectivity.

"T-Mobile is committed to all of our customers across the country," the company told CNBC in a statement. "Our actions have always been focused on better serving our customers and the ringtone oversight, which was corrected in January 2017, was unintentional. We have settled this matter — and will continue to focus on our mission."

— CNBC's Todd Haselton contributed to this report.