“The Cop and the Anthem” has an ironic and lighthearted tone. This comes across from the very beginning of the story, when the narrative introduces Soapy's motivations for wanting to be arrested:
For years the hospitable Blackwell’s had been his winter quarters. Just as his more fortunate fellow New Yorkers had bought their tickets to Palm Beach and the Riviera each winter, so Soapy had made his humbler arrangements for his annual hegira to the Island. And now the time was come.
Here, the narrator is painting a bleak portrait of a houseless man whose only option for surviving the winter is to be willingly locked up at Blackwell’s Island prison, yet the tone remains lighthearted. O. Henry achieves this by framing the situation in a positive light—the prison is described as “hospitable” and as Soapy’s “winter quarters” rather than as a prison (in fact, O. Henry avoids the word “prison” altogether when referring to Blackwell's Island). O. Henry takes this positive language to a humorous extreme in comparing Soapy’s voluntary imprisonment to wealthy New Yorkers’ winter trips to Palm Beach and the Riviera.
While some writers offering social commentary use a more serious or somber tone, there is a long history of authors approaching tough subjects with irony and playfulness in order to highlight the absurdity of certain aspects of society. O. Henry is carrying on this tradition by highlighting the comical, absurd nature of some New Yorkers having the financial resources to winter in Europe while others have to strategically con their way into being imprisoned in order to have access to a warm bed. In this way, O. Henry is critiquing the so-called American Dream, highlighting how the real story of the United States is one of a class divide that grants some people immense privilege while others must navigate poverty and prison.