Like many other authors of his generation, in writing a novel such as The Scarlet Letter, Hawthorne does not aim to produce a work of morality or immorality. The Scarlet Letter tells the long story of the multiple vicissitudes that occur to a woman accused of having committed acts that are perceived to be sins by her fellow villagers, and under the parameters of the Puritan faith.
However, never in the novel does the reader witness Hester Prynne judging her choices as moral or immoral. Her own view of her acts is amoral; she understands that the conception of Pearl is what ultimately brought about the scandal of it all. The relationship that she had with Dimmesdale, and the love she felt for him, however, go completely uncondemned on her part.
Rather than teaching the "evils of adultery" in the moral life of Hester Prynne, The Scarlet Letter illustrates the unfairness of so-called moral and religious people whose sanctimonious nature is actually what tries to ruin Hester, not necessarily having loved a man and conceived a child by him. This is because it seems as if almost everybody in the village of Boston was also sinning behind closed doors without "getting caught".
Moreover, the story is not told from the focalized view of Hester as a sinner but also through the eyes of Reverend Dimmesdale and Roger Chillingworth, each having their own personal reasons to suffer.
Dimmesdale suffers because his own view of himself as a saintly man has fallen to the ground and he now realizes that, not only is he a "saint of clay", but he is also a feeble coward. The carving of the letter on his chest and his never-ending sickness could have been avoided if he had only taken responsibility of his acts.
Chillingworth's choice to enter a life-long battle against Dimmesdale is to redeem his weakened ego; he knows that he had failed Hester as a husband, and as a man. He knows that Hester's marriage to him was one of many other Puritan marriages built out of obligation, rather than love. Hester, herself, is clear with Chillingworth throughout the novel that she never loved him nor pretended to love him when they were married back in England. Even then, Chillingworth's bruised ego as a man leads him to believe that he had been wronged. As a result, the dedicates the rest of his life to make Dimmesdale pay for what he did. His work did not produce any extraordinary results.
Then there is the scarlet letter, itself. Its once moral-bound meaning changes throughout the novel, and becomes even a token of distinction. It never really changes Hester into a prude at heart, nor does it make her regret anything. Like the narrator explains,
The scarlet letter has not done its office
All this being said, is The Scarlet Letter a novel that will teach a reader about morals? Maybe if you conduct a morality-based close-reading of the novel, you may find some indication of how leading a moral life could save you from the scaffold. However there is so much more in the narrative, all which is more important than the theme of "morality"; there are a myriad of thick themes such as passion versus lies, redemption versus condemnation, society versus women's rights, Puritanism versus hypocrisy. In all, there is much more to tell from this novel than just labeling it as "moral" or "immoral". It just would not be fair to Hawthorne, at all.