In "Young Goodman Brown," what do you think Hawthorne gains (or loses) by the last sentence?
And when he had lived long, and was borne to his grave a hoary corpse, followed by Faith, an aged woman, and children and grandchildren, a goodly procession, besides neighbors not a few, they carved no hopeful verse upon his tombstone, for his dying hour was gloom.
Hawthorne certainly loses any sense of redemption in the character of Goodman Brown. Whether or not his experience was a dream or real is irrelevant to Brown. He had seen the possibility and/or reality of sin in the world. He loses faith in himself, possibly in his wife, and of those around him.
What Hawthorne gains is an ending that does not deviate from his diatribe against religious self-righteousness and strict religious dogma. Hawthorne rails against this kind of fundamentalist religious doctrine in his other works (The Scarlet Letter). It is a gloomy ending for Brown but that is an effect of his inability to accept that people are capable of good and evil. Brown is too much of an absolutist, too stubborn to see the world in terms of good and evil and deal with it on those terms. He is an "all or nothing" character; in other words, "once a sinner, always a sinner." The very fact that his life ends in gloom is a product of his obstinacy. In other words, Brown can only redeem himself and his faith by accepting human fallibility. Since he can not accept this, he loses his faith and dies miserably. Had Hawthorne given us a happier ending, he would have had to include Brown's realization and acceptance of the flaws of humanity. But Hawthorne doesn't do this. What Hawthorne gains then is a more striking story; one about a stubborn religious character (Brown) who can only seem to have faith if the world is completely righteous. Following Brown's journey into the woods, he lost hope and faith; a time when faith is most useful. Brown gave up on hope and faith; the last line concludes this unfortunate end.