Where It All Goes Down
Alabama, around the town of Summit
The story is set in Alabama, but it's really more about the time than the place. It could be the Wild West or upstate New York or anywhere in between; what's important about it is its "small townness," that kind of Norman Rockwell close-knit community that, for many people, defines what it is to be American.
Naturally O. Henry has his own idea about what these towns are like—the sort of place where a kid like Johnny can run wild—and about how much more knowing they are about life than people sometimes attribute to them. Sam and Bill don't think much of these kinds of towns, full of "inhabitants of as undeleterious and self-satisfied a class of peasantry as ever clustered around a Maypole" (2). More importantly, they think such towns are safe, and "Summit couldn't get after us with anything stronger than constables and, maybe, some lackadaisical bloodhounds and a diatribe or two in the Weekly Farmers' Budget" (3).
They're in for a rude awakening when the town (or at least its most prominent citizen) proves a lot smarter than they thought and ends up taking them for the proverbial ride.
Besides being a statement about the American character, Summit also serves a significant role in the pacing of the story. O. Henry sets up our expectations with the first impressions of the town, then brings them shattering to the ground with the big twist ending. Summit becomes a part of the comedy, confounding what we (and the heroes) think they know, then leaving the two of them (and us by proxy) to wallow in the mess we make. That's a lot of heavy lifting for a throwaway setting in a very short story. It's like the author was really good at what he was doing or something.