After Beowulf, with Wiglaf's aid, destroys the dragon, Beowulf is mortally wounded, but as he looks around at the treasure hoard, he says
Now I have given my old life/for this treasure hoard; fulfill henceforth/the people's needs; I may stay here no longer. . . .
As the good king he is, Beowulf has given his life not only to protect his people from the dragon but also to provide his people with enough wealth to take care of them after he is gone. At this point, we assume that the gold hoard will be taken out of the dragon's barrow and put to use.
Unfortunately, the distinguishing feature of Beowulf's death is that his loyal retainers, with the exception of Wiglaf, failed to come to his aid when Beowulf could have used their help. Wiglaf decides that the treasure hoard, because it is tainted by the cowardice of the men who should have supported Beowulf, should become part of Beowulf's funeral pyre and barrow:
. . . these shall the fire eat,/the blaze enfold--nor shall an earl wear these|rings as reminders, nor a fair maiden/wrap her throat/in a ring adornment, . . .
The hoard, because it stands as a symbol of betrayal, is put into Beowulf's barrow where it lies for all time as "useless to men" as when it lay in the dragon's barrow.
The dragon's hoard is buried with Beowulf's ashes.
After the dragon is killed, Beowulf tells Wiglaf to look for the dragon's treasure and to bring it to him. Beowulf feels that death will be easier to bear if he can look at the treasure with his own eyes. He wants his people to have the treasure, noting that his death will not be in vain if his people can profit from the fruits of his death.
When Wiglaf enters the dragon's tower, he sees piles of gold, precious gems, and priceless tableware strewn about. He takes what he can back with him to Beowulf, making haste lest Beowulf should die before he sees what he has won. When Beowulf sees the treasure, he thanks God for it and proclaims that he has sold his life well for the treasure. Before he dies, Beowulf gives Wiglaf his golden necklace, rings, mail shirt, and gold-covered helmet.
After Beowulf dies, his followers show up. Wiglaf excoriates them for their cowardice in leaving their king to fight the dragon by himself. He tells them that they will not have the treasure, because they have disgraced themselves. So, the warriors end up building Beowulf his funeral pyre and burying the dragon's hoard with his ashes.
They placed in the barrow rings and jewels,Rings and gems are laid in the barrow.All such ornaments as erst in the treasureWar-mooded men had won in possession:The earnings of earlmen to earth they entrusted,The gold to the dust, where yet it remainethAs useless to mortals as in foregoing eras.