The great thing about language is that you can just as easily use it to do the opposite, convince people ... to live in America, but if he speaks in broken English, people say, 'Hey, I don't trust this guy.
Here, Hamlet is using a metaphor. Metaphors compare two things, yet differ from similes in that they don't use "like" or "as." He is comparing Denmark to a prison, meaning that he feels that the city is confining and bleak.