"Mean Mr. Mustard" was actually part of a double recording performed in tandem with the preceding track, "Sun King," as part of John Lennon's three-song contribution to Abbey Road's famous closing "medley" that concluded the Beatles' recording relationship as a group. Although Lennon often distanced himself from the "medley" concept, dismissing it as purely a McCartney idea, he did offer three excellent song fragments that were worked into the finale, along with the following. Lennon admitted to playing along, even willing to fudge lyrics to create more of a common thread between songs: "In "Mean Mr. Mustard," I said, his sister Pam -- originally it was his sister Shirley in the lyric. I changed it to Pam to make it sound like it had something to do with it."
The song is a brief one, lasting all of one minute and six seconds, with oddball lyrics and a simple, infectious melody consisting of a two-chord progression with jouncing piano and a fuzzed bass guitar. Lennon sings in a laid-back voice, relating this ornery character's various eccentricities: "Mean Mr. Mustard sleeps in the dark/Shaves in the dark, tryin' to save paper/Sleeps in a hole in the road/Saves enough to buy some clothes/Keeps a ten bob note up his nose." McCartney joins in the short chorus with some tight vocal harmonies, repeating the line, "Such a mean old man/Such a mean old man." Following the second verse, the beat becomes choppy, accenting a descending progression as Lennon and McCartney harmonize on the final chorus line, "Such a dirty old man/Dirty old man," the last note being cut off as the song segues directly into the next track of the "medley," "Polythene Pam."
That last note did not go unheard, however. Mark Lewisohn's incredibly detailed book The Beatles Recording Sessions: The Official Abbey Road Studio Session Notes cites an early rough mix of the side two "medley," originally placing "Her Majesty" in between "Mean Mr. Mustard" and "Polythene Pam." McCartney later decided against including the short track, instructing an assistant engineer to "throw it away." The engineer had been instructed by his superiors never to throw anything away from a Beatles recording session and dutifully saved the short piece of tape, attaching it to the end of this early mix, accidentally including the last crashing note of "Mean Mr. Mustard" at the beginning of "Her Majesty." The event was eventually deemed a happy accident by the group and left in the final album version of Abbey Road.