Throughout the Scarlet Letter, Hawthorne is very ambiguous about his perception of Hester's adultery. In some ways, he does seem to show her actions in a negative light. He shows Hester as being an outcast from society, and dooms her to wear the scarlet letter for the rest of her life.
However, the majority of the novel points to a positive perception of Hester. Hawthorne seems to want her to be sympathized with (seen in the beginning of the novel when Hawthorne describes the hypocrisy with which she is judged). He paints her as a strong, independent woman, resembling the Romantic hero of the time in many ways.
The ending of the novel shows most clearly Hawthorne's view of Hester Prynne. While on the surface, choosing to return to Boston and where the Scarlet Letter for the rest of her life seems like a final punishment, in reality Hawthorne is celebrating her decision to remain true to who she is as an individual. The moral of the story, "Be true, be true, be true," can only be applied to Hester, because she is the only one (with the exception of Pearl) who consistently represented herself in an honest way, even embracing the flaws that come from being human. Hester is Hawthorne's heroine in the novel, and is meant to be viewed as a beckon of individuality and honesty in a society of hypocrisy.