Figurative language is used in literature to provide more of a mental picture or create some sort of impact beyond using language literally. Hyperbole is used when Robinson writes:
But still he fluttered pulses when he said,
'Good-morning,' and he glittered when he walked
Clearly pulses would not literally flutter, nor did he really glitter beyond what jewelry he might have worn. He did, however, cause a stir of excitement.
Robinson also uses a simile when he says
And he was rich - yes, richer than a king -
And admirably schooled in every grace
Comparing Richard Cory to royalty serves to create more of a divide between the town people and Richard Cory, and the attitude of the town people isolates Richard.
This isolation is revealed in the last line of the poem
Went home and put a bullet through his head.
The figurative language reveals the envy of the town people, and makes the isolation that Cory feels even more poignant.
eNotes has some great resourses to help with this poem.