Here in America, I have never once heard someone unironically pronounce tomato like the second example in this verse. I assume some people in maybe europe do? Do you pronounce it that way? How about Potato?
As many have pointed out, tom-ah-to is the standard British pronunciation. I've only ever heard North Americans pronounce the word differently.
The original musical in which this song appeared is about a romance between a ballet dancer played by Fred Astaire and a tap dancer played by Ginger Rogers. They move in different social circles. In the early twentieth century the American upper classes had a different accent from many common people, particularly in the East. You still hear it in early talkies, say, Katherine Hepburn's upper class New England accent. Or Margaret Dumont in Duck Soup and other Marx Brothers films where she's a foil to Groucho's wisecracking New York City swindler. This accent has more or less died out now.