Judge Thatcher, Tom, and several boatloads of men immediately head to the cave's entrance. Removing its barrier, they find Injun Joe's dead body. Tom realizes he's relieved to no longer fear being murdered.
Tom thinks of his own welfare only after considering Injun Joe's safety. His judgment has developed significantly since earlier in the novel, when it took him several weeks to stand up for Muff Potter for fear of being harmed by Injun Joe.
Injun Joe's broken bowie knife lies beside him, with evidence of how he carved away futilely at the cave's exit, ate bats, and gathered water from dripping stalagmites in his final days.
Injun Joe's death also proves a valuable moral lesson for boys: outlaws will not escape in the end, and their attempts to evade justice will bring their doom.
Injun Joe is buried outside the cave, with a crowd gathering for his funeral, feeling it's as significant an event as his hanging for killing five villagers would have been. Sympathetic women petition the Governor to pardon him in death.
Twain chides the naivety of the women in the village who believe Injun Joe should be pardoned, mocking how they fail to comprehend real criminality. They seem to be petitioning only to prove their own saintliness.
Huck and Tom finally catch up on all that they've been up to in each other's absence. Huck had assumed Tom made it into No. 2 at Temperance Tavern to find whiskey rather than treasure. Tom explains this never happened, instantly realizing that "Number Two" must be the cave! They gather provisions and head to the cave to find the treasure.
Huck and Tom reunite as two young men who have proven their mettle. They set out again for an adventure that sounds like something out of a romantic tale that is as improbable as their becoming pirates earlier in the book. Yet they know the treasure is real.
Tom leads Huck to the outlet he found. He brags that they'll form a new band of robbers with Joe Harper and Ben Rogers called "Tom Sawyer's Gang", and hide women they're holding for ransom in the cave. Huck thinks it sounds even better than pirating.
Tom and Huck have not lost their imaginations even as they have become more responsible members of the community. As Twain noted in his preface, the boys should serve as examples to adult readers of traits from childhood that shouldn't be lost.
Tom shows Huck around the cave, leading him to a wall with a cross made from smoke on it, reminding Huck that Injun Joe said the treasure was beneath a cross. They hunt around, but find no treasure. Tom looks under a large rock, and underneath finds a natural chasm, which the boys climb into to find the treasure box, an empty powder keg, a few guns, moccasins, and other random stuff.
Tom proves that he has learned from his mistakes last time in the cave, diligently keeping track of their path and successfully leading them to the treasure. He is the capable hero of this final adventure..
Knowing the treasure box might be too heavy to carry, Tom brought along bags to help carry it out. After they have packed up the treasure and are ready to leave, Huck suggests they take the guns. Tom says they're best left there for their gang's use. He plans to have orgies there, though he admits he doesn't know what orgies are, just that robbers have them.
Tom continues to enjoy the wild fantasies which he knows about only through reading books. As his comment about not actually know what orgies are indicates, though, Tom is now able to distinguish between reality and fantasy, and indulges in the latter only for his and Huck's entertainment.
Back in town, they find a wagon to cart the treasure to a hiding place in the widow Douglas's woodshed. When they stop to rest in front of the Welchman's house, he finds them there, and tells them they must come up to the widow's house, where they're expected. Huck is suspicious of being punished for something, and says: "Mr Jones, we haven't been doing nothing." They all head to the widow's, with the Welchman pulling the wagon.
Once again Tom is welcomed back into the village after a dangerous escapade. This time, however, he is not returning as a lost boy. He and Huck have pulled their adventure off with adult planning and ability. Tom falls easily into the villagers' company, but Huck has learned from experience not to expect their welcome. Their differing reactions to the Welchman predicts how they will occupy different positions in the village as adults.
At the widow's, much of the village is assembled, in their Sunday best. The widow tells Tom and Joe to and put on the two new suits upstairs, which the Welchman and the widow bought for Huck.
The boys' esteemed status is manifest in the clothes they are told to wear. Whereas no boy wants to even wear shoes, Tom and Huck are now expected to wear suits. Their inner psychological development is thus acknowledged by their public.