Nathaniel Hawthorne did not come to Puritan Boston as a stranger. His own great great grandfather, John Hathorne, sat as a judge during the 1692 Salem witch trials, sentencing the accused with no recorded second thoughts. He was, in fact, the one judge of the whole proceeding who never repented. Family embarrassment ran deep enough that Hawthorne is thought to have added the "w" to his own name to put some distance between himself and his ancestor.
That distance is not what shows up in The Scarlet Letter, published in 1850 and set two hundred years earlier in the same Massachusetts Bay Colony Hathorne once helped govern. Before the novel's story even begins, Hawthorne steps forward in his own voice in "The Custom-House," the long autobiographical sketch that serves as its introduction, and addresses his ancestor directly. He calls out the "persecuting spirit" he inherited and asks that "any curse incurred by them... may be now and henceforth removed."
The novel that follows is built entirely around a congregation's power to judge, expose and shame one of its own, a Puritan church discipline exercised in public, on a woman made to stand before the whole community wearing the mark of her sin. Hawthorne was not writing a neutral period piece. He was working, in full view of his readers, through the specific inheritance of a judge who once wielded exactly that kind of communal authority and never once looked back on it.