Sprint had some barbs of its own. In 2011, when AT&T was trying to take over T-Mobile, Sprint ran an ad arguing against the potential merger. To illustrate its point, Sprint dressed a cigar-toting man in a pink polka-dot dress that was similar to something Ms. Foulkes might have worn in a T-Mobile commercial. The tagline: “It makes sense if you don’t think about it.”

[Read more about the merger and the conditions imposed by the Justice Department here.]

The ad was poorly received, and not just by T-Mobile. Michelle Bradley, a transgender woman and community radio advocate, wrote in a blog post that Sprint had “crossed the line.” The company pulled the ad, which had run in newspapers and online.

Sprint went beyond the usual bounds of advertising speech again in a 2016 commercial that took aim at T-Mobile. Mr. Claure appeared in the ad, soliciting opinions from a group of wireless customers gathered in a glass-walled conference room. Turning to a white woman seated to his right, he asked her to tell him “what comes to mind” when she heard the name T-Mobile.

“Oh my god, the first word that came to my head was ‘ghetto,’” she responded, grimacing, as Mr. Claure nodded.

He later linked to the video on Twitter, writing that “sometimes the truth hurts.” Within hours, the video had been taken down, and Mr. Claure had apologized for the company’s “bad judgment.”

As the two companies moved closer to a merger in recent years, the rhetoric mellowed. And on Friday, when the Justice Department announced that it had approved the deal, the combative tone that once characterized the carriers’ marketing efforts seemed all the more strange.

In retrospect, the hostilities between T-Mobile and Sprint were nothing more than marketing theatrics. The two companies came to decide that, if they were going to compete on an equal footing with AT&T and Verizon, they would need to become not only allies, but partners. The trash-talking stopped.