This old vaudeville song was recorded by lots of artists through the years, with the title changing depending on the locale. (Buffalo refers to the city in New York, not that hairy beast of the American plains.)
The song appears many times during the film and comes to represent George and Mary's relationship. (Source) We first hear some strains of it during the opening credits. It's played when they dance at the high school, and Mary sings it later that night as she and George are romancing it up. She puts it on her record player the night George comes over years later in hopes of rekindling some memories. When George storms out, Mary smashes the record—the relationship seems done for, too.
But, the gal gets her guy after all, and the next time we hear the song, Mary is singing it just before she tells George she's pregnant. Finally, an upbeat version plays during the final credits; it has followed the couple along throughout the movie. We're not sure why Capra or the composer chose this song, except that it was popular with kids at the time and has all of that moon imagery that plays a big role in the romantic storyline.