"Richard Cory" was written by Edwin Arlington Robinson in 1897 and reflects a period of high income inequality in the United States, exacerbated by the Panic of 1893, a depression caused in part by bank runs.
The first theme of the poem is economic inequality. Rather than wealth being distributed evenly within the town, it is unequally distributed, causing significant social stratification. Although Cory is apparently polite and not disliked, there is a vast social gulf between him and the townspeople and no possibility of friendship or even shared activities and interests.
The second theme is that money does not bring happiness. Although Richard Cory was "richer than a king", he still committed suicide.
A third theme is the impossibility of knowing what happens within the mind of other people. The nameless narrator of the poem observes Richard Cory from the outside, thinking:
In fine, we thought that he was everything
To make us wish that we were in his place
The narrator, though, has no idea whether Cory is actually happy or not or whether his "place" is pleasant.