New York in the prior century(the 19th) was known as a basically inhospitable place, lacking functioning street sanitation. In this environment, people would simply dump things into the street, as had been done for centuries throughout the world. Robin Nagle's study of this period places a turnaround starting in 1895, when organized street cleaning efforts began in earnest.
By the 1930's, the pre-sanitation era would be far in the past, but still in living memory, in the same way that we still have some memories of life in the 1950's. In that context, this kind of gag would constitute a form of "dated reference," a nod to a bygone era. Illegal dumping still occurs everywhere, even now, but our cultural views are different because the omnipresence of cleaning efforts and formal garbage management systems makes clean streets the norm.
Edit: 1881 is when the department formed, but the source claim is that real efforts only started between 1893-1895.