The Scarlet Letter depicts the dynamics of guilt and shame in seventeenth century Massachusetts Bay Colony's Puritan society, but we may find similar forces in communities where established social norms direct members' behavior.
Hester Prynne has to wear the scarlet letter "A," a symbol of shame, for committing adultery. The town fathers seek to enforce the Puritanical code through shame and alienation from the community. But grounded in her identity, Hester stands tall and calm on the scaffold and refuses to acknowledge the power of the town fathers or of the social nrom. Throughout the novel, we see her directing her destiny: helping the sick and the poor, seeking to leave Boston with her lover, returning from Europe wearing the scarlet letter, not as a symbol of shame but one of defiance.
On the other hand, her lover, the minister Arthur Dimmesdale, avoids shame, because Hester refuses to name him, but guilt torments him so much that his health deteriorates. His guilt may have come from having an affair with Hester, though her husband is presumed dead, or from allowing her to suffer alone. Whatever the reason, the same power that Hester refuses to acknowledge crushes and ultimately destroys him. So, while Hester embodies shame without guilt, Arthur does guilt without shame. He has internalized the Puritanical system such that internal punishments may exceed any external ones.
The contrast between Hester Prynne and Arthur Dimmesdale is an interesting study in human character. While some in society respond more to external punishments, other avoid transgressions for fear of internal ones.
The Massachusetts Bay Colony, like other communities, uses both external and internal forces to direct behaviors. But one problem comes from government merging with religion, and the legal code, besides protecting individual rights, enforces morality. Laws and punishments curtail behavior and therefore have vital roles in society, but they cannot "create good people." Whenever, we force people to be "good," the result is either conformity or rebellion, not "goodness."
Another problem: though Hester's husband is presumed dead, the town fathers punish her for having an affair and consider it adultery because she is legally married to him. And she probably couldn't get a divorce. So, here the legal code traps wives whose husbands have passed away and they become widows for life. So legalism can be dangerous.