You hear about an awesome party happening in the Valley. Only problem is, if you go, you know you'll end up being at least half an hour late for your curfew. (Even though everywhere in L.A. takes twenty minutes.) Do you (1) ask for permission and grudgingly obey when your parents say no, or (2) go and beg for forgiveness later?
If you answered (1), congrats! You'd fit right in with the Puritans, who are a legalistic crew: they believe that your best bet to get to heaven is to conform to strict set of religious and social laws. If you answered (2), you'd probably fit in better with a religion that emphasizes grace: being forgiven for your sins through faith. In The Scarlet Letter, Hawthorne shows us an essentially legalistic society, with its inhabitants adhering to strict moral codes, and punishing and isolating transgressors. But the narrator disagrees. Maybe, he says, a religious society should be ruled by grace—and, at the end of the novel, Hester has been forgiven by the strict society that once punished her.
Although Hester Prynne is judged and punished in a legalistic society, she transforms her scarlet letter into a symbol of grace rather than shame.
Even though Reverend Dimmesdale avoids confessing his sin for seven years because he fears the wrath of a legalistic society, he finds grace through confession in the last moments of his death.