What is the moral of the story?
I believe it would be safe to say that the theme of O. Henry's story "After Twenty Years" is an old one: Crime Does Not Pay. O. Henry contrasts two different characters who have two different philosophies and two different value systems. Bob is greedy and materialistic. He wants to make a lot of money, buy a lot of things, enjoy a life of luxury, and display his success conspicuously. And he doesn't care how he gets the money as long as he gets it. Jimmy is conventional and conservative. He wants a good steady job that is socially useful. He wants a home and a family. The two men's different philosophies take them on different paths until they finally meet again after twenty years. Jimmy has a good steady job that is useful to society. He likes his work and he has security. When he retires, he will receive a pension for the rest of his life. Bob, on the other hand, has made a lot of money through crooked means. Still, he has no home, no family, and no security. The money hasn't really done him much good. He has spent some of it on a scarf pin with a big diamond and a pocket watch decorated with small diamonds. It is important to him to have other people look at him, to admire and envy him. He is always on the run, and it is probably inevitable that he will end up in prison sooner or later. In O. Henry's story, Bob discovers that he can't even trust the man who used to be his best friend. Bob probably has no close friends because he never stays in the same place long enough to acquire friends, and also because he is not the kind of man that decent people would want to have as a friend. His flashy lifestyle has made him conspicuous, easy to identify wherever he goes. His career ends when he is led off to jail. If he has a whole string of crimes charged against him in Chicago and elsewhere in the West, he could be spending a long part of his life in state prisons. Crime really does not pay.
The theme of "Crime Does Not Pay" is also to be found in at least two of O. Henry's other most popular stories, "A Retrieved Reformation" and "The Ransom of Red Chief." In "A Retrieved Reformation," Jimmy Valentine falls in love and plans to get married, but he realizes that his whole shady past has come back to haunt him, regardless of how much money he stole and how highly regarded he might be in the underworld as a professional safe-cracker. In "The Ransom of Red Chief," the two kidnappers are forced to pay to get rid of their victim. O. Henry served time in prison for embezzlement, and he associated with professional criminals after his release. He must have come to realize that crime ultimately catches up with its perpetrators.