What is rumored to be buried in the swamp?
The story begins with a prologue, which was probably intended to provide the story with elements of the Romantic genre as well as a distinct "American" quality. The prologue establishes that Captain Kidd, a legendary pirate who was familiar to New Englanders, had buried a treasure in the swamp. Kidd was rumored to have buried treasures in real life, and this tale is probably playing off of the popular culture and myths of its time.
Kidd is supposed to have buried the treasure with the help of the Devil, who now presides over it. This is an element of foreshadowing, suggesting that the Devil will interfere with, harm or corrupt anyone who goes after the treasure, and contributing to the overall dark tone of the story.
The treasure's origin and nature don't factor into the story again, lending weight to the idea that it was described for purposes other than contribution to the plot itself. Ultimately the treasure itself is irrelevant to the story; what is important is the effect it has on the characters and the subsequent decisions they make, although the material wealth it provides does figure into Tom's life once he attains it.