There are two aspects to the beginning of the story; a brief introduction of the treasure, and an introduction of Tom and his wife.
The treasure is introduced first, as a sort of prologue (one might imagine that a modern retelling, particularly a film, would show these events as a flashback). There is nothing particularly mood-setting about this introduction until it is mentioned that a pirate treasure was buried, and that this was presided over by the Devil. This creates a mood of foreboding, because we know that the treasure was not only coming from a "sinful" origin, but that it is now directly entwined with the supernatural; we also assume that if the treasure is being shown to us, then it must appear again, boding ill for whoever encounters it.
The mood shifts as we are introduced to Tom and his wife, and the mood here is clearly a combination of disgust and pity. Their home is described as forlorn, sterile and unenviable, and their personalities as caustic and petty. We are being led to dislike them from the start, and perhaps the intention is to lead the reader to a mood of superior moral authority, in effect scolding the characters because we already have an idea of what's going to happen to them (something bad), but knowing that they probably deserve it.