Tom and Huck overhear Injun Joe and his accomplice discussing the treasure.
Tom is obsessed with pirates and treasure, as most boys are. However, one day he overhears two conmen, Injun Joe and his accomplice, discussing an actual treasure—their loot. They have buried it beneath the floor of their hideout.
"Oh, partly, partly. Nearly time for us to be moving, pard. What'll we do with what little swag we've got left?"
"I don't know—leave it here as we've always done, I reckon. No use to take it away till we start south. Six hundred and fifty in silver's something to carry." (Ch. 14)
Since the two men are obviously dangerous, Tom and Huck can’t just barge in and steal the treasure from the outlaws. Huck sees the men move the treasure and follows them. At the same time, Tom gets lost in a cave with Becky, and they find the treasure there. Fortunately for them, Injun Joe dies in the cave and Tom and Huck get the treasure. They are rich!
It was the treasure-box, sure enough, occupying a snug little cavern, along with an empty powder-keg, a couple of guns in leather cases, two or three pairs of old moccasins, a leather belt, and some other rubbish well soaked with the water-drip. (Ch. 33)
The whole town of St. Petersburg is excited by the news of the hidden treasure. It is more money than most people can imagine. Tom and Huck become local celebrities. The money is invested for them, and they earn an income of “a dollar for every weekday in the year and half of the Sundays” making them very wealthy indeed, especially for boys.
The treasure will later become a problem for Huck, when his no-good father finds out about it and tries to get it from him. This is an example of the difference between the mostly carefree The Adventures of Tom Sawyer and the more serious The Adventures of Huckleberry Finn. For now, the treasure is just fun.