These photos were all taken by Stanley Kubrick during his time as photographer for Look Magazine. The series of images, from the Museum of the City of New York's expansive archives, is titled "Life and Love on the New York City Subway." The images were taken in 1946 and show straphangers from that time... as well as a gum machine right there on the subway platform. Back in the day, the platforms had candy, cigarette, and even horoscope machines! These existed for decades to come, and you can see some of them in this video showing the system in the 1950s—which is pretty terrific in its own right:
More photos of 1940s New York through Kubrick's lens can be seen here.