A rational person would prefer the Cooperate/Cooperate outcome [Pareto optimum] (and gain 3) to the Defect/Defect outcome (and gain 1). However, it is the dominant strategy to defect [Nash Equilibrium]: for either of my opponent's strategies, defection always has the higher payoff to me. If my opponent defects, then I win 1 if I defect instead of 0 if I cooperate; if my opponent cooperates then I win 5 if I defect instead of 3 if I cooperate. Of course, defection is my opponent's dominant strategy as well. So on one analysis, Cooperate/Cooperate is the preferred outcome; on another analysis, Defect/Defect is the preferred outcome.
There are two ways to resolve the Prisoner's Dilemma for the Pareto optimum. The first is to iterate the game an indefinite number of times and play "tit-for-tat". But it's not always possible to iterate a game indefinitely.
The second is to change the game by changing the payoff matrix, usually by threatening external punishment for defection. For example, if the townspeople agree to get together and beat either of us senseless if either cheats in a closed bag exchange, then we've changed the payoff for defection from 0,5 to 0,-1000, making cooperation the dominant strategy, and making one choice unambiguously rational (the Pareto optimum is also the Nash Equilibrium).
However, if you can change the game in one way, you can change it in other ways. We can just as easily change the game so that it's asymmetric, making it for instance always rational for brown-eyed people to cooperate and blue-eyed people to defect by punishing only brown-eyed people for defecting. Changing the low-level game just makes another Prisoner's Dilemma at a more abstract level: Cooperate becomes "make the game symmetric" (or make good laws/obey the law); "Defect" becomes "make the game asymmetric" (or make bad laws/disobey the law); the Nash Equilibrium is for the authority to make bad laws and the subjects to disobey them.
For this reason, purely authoritarian approaches to solving the Prisoner's Dilemma always fail. The authority will try to change the game for its exclusive benefit, sooner or later depending on how rational and intelligent the authority is; the subjects will then resist the authority. Authoritarian solutions to the Prisoner's Dilemma are dynamically unstable.
To a certain extent, religion can coerce the Cooperate/Cooperate outcome by changing the game: God will punish you for defecting and/or reward you for cooperating (and perhaps reward you more if your opponent defects). This is the sense I spoke of earlier of how religion could have an overall beneficial effect. The effect is weak; religion is a dynamically unstable authoritarian strategy.
(Pseudo-authoritarian solutions are possible, but only where you have competing authorities, who themselves play tit-for-tat. However, within-authority conflicts will always revert to the Nash Equilibrium.)
Democracy is a clever way of solving the Prisoner's Dilemma in a dynamically stable way. The people and the government play a abstract-level game of tit-for-tat — we need to make sure that only one abstract-level authority/submission game is iterated — and can thus implement any number of concrete-level Pareto optima where direct iteration is impractical. Of course, like any system in dynamic equilibrium, democracy is susceptible to sufficiently large "random" forces to push it to a state where the equilibrium cannot be maintained. If the government becomes too powerful, the people cannot "punish" the government sufficiently and the government can "defect" with impunity; likewise a too-weak government invites the people to "defect" into anarchy and chaos.