Original: Lennon changed it to Pam when he saw the opportunity to ease the segue into the song "Polythene Pam", which follows "Mean Mr. Mustard" on the album.
Simplified: Lennon changed it to Pam when he saw the ochance to ease the segue into the song "Polythene Pam", which is after "Mean Mr. Mustard" on the album.