It is, indeed, ironic that a people who have fled England for religious freedom build a prison when they arrive in New England. This prison is constructed for the punishment of anyone who sins against the strict doctrines of Puritanism. In a sense, the Puritan religious culture is a totalitarian one, subjecting any offenders to the scaffold and other public ignominy.
In Chapter 2 of "The Scarlet Letter," the sanctimonious women condemn Hester and suggest more violent torture for her; this hypocritical attitude of supposed Christians is what Hawthorne found so objectionable in early American Puritanism. Hawthorne writes in Chapter II that Hester's anticipated appearance could be mistaken for the same as the hanging of an old witch:
In either case, there was very much the same solemnity of demeanour on the part of the spectators; as befitted a people amongst whom religion and law were almost identical, and in whose character both were so thoroughly interfused, that the mildest and the severest acts of public discipline were alike made venerable and awful.
And, while the women want more punishment for Hester,
'This woman has brought shame upon us all, and ought to die. Is there not law for it? Truly there is, both in the Scripture and the statue-book...'
the beadle proclaims the virtue of a society in which sin is exposed and punished:
'A blessing on the righteous Colony of the Massachusetts, where iniquity is dragged out into the sunshine! Come along Madam Hester, and show your scarlet letter in the market-place!'
The cruelty of the Puritans who expose Hester to shame is shocking when one considers their flight from England for the harsh treatment given them. As Hester stands upon the scaffold, Hawthorne writes that a papist would see some of the Madonna in the beautiful woman with her babe, but the Puritans "had not yet passed beyond their simplicity." Clearly, here Hawthorne expresses his disgust with the hypocrisy of the Puritans.
It was a theocracy. Religion and government were intertwined and one had to do with the other and vice versa. That is why Hester's "sin" (adultery) was treated like a crime.