There are two treasures in "The Man That Corrupted Hadleyburg": one literal (the sack of gold that the stranger leaves in town) and one metaphorical (the unassailable virtue of honesty in Hadleyburg's nineteen prominent citizens that turns out, by the end of the story, to be quite assailable indeed). The tension between these two treasures presents a central irony of the story: despite being in possession of one treasure, Hadleyburg's Nineteen fall over themselves to seize the other—which turns out to be fake.
In Reverend Burgess's speech to the crowd in Section 3, before he unwittingly reveals every one of the Nineteen save Edward Richards to be a fraud, Twain plays on this metaphorical characterization of the town's honesty as treasure:
And who is to be the guardian of this noble treasure—the community as a whole? No! The responsibility is the individual, not communal. From this day forth each and every one of you is in his own person its special guardian, and individually responsible that no harm shall come to it.
The irony of the situation only increases, as Twain adds dramatic irony into the mix: Burgess has just emphasized the singular importance of individual integrity to safeguard the town's reputation by pronouncing the citizens the "guardians" of this honor, and yet the reader is well aware that each and every one of the Nineteen are about to betray it in the hopes of inheriting the gold.
Later, in the stranger’s postscript to the citizens, he emphasizes the impossible wealth of virtue that has been lost:
You had an old and lofty reputation for honesty, and naturally you were proud of it—it was your treasure of treasures, the very apple of your eye.
The gold turns out to be lead—the promised treasure is worthless—and the honesty that Hadleyburg's Nineteen sacrificed in vain turns out to be the only thing valuable that was actually at stake. They recklessly "exchanged" their virtue for the prospect of material wealth—and, in the process, revealed their extreme vanity.
In Section 3, a massive crowd gathers in Hadleyburg to witness the Reverend Burgess reveal the rightful inheritor of the sack of gold. To kick things off, Burgess gives a melodramatic speech in which he waxes poetic about the treasure and the town entrusted with its care. Despite his hyperbolic insistence on the value of the sack and the virtue of Hadleysburg, Burgess's speech fosters a sense of dramatic irony in the reader:
He related the curious history of the sack, then went on to speak in warm terms of Hadleyburg’s old and well-earned reputation for spotless honesty, and of the town’s just pride in this reputation. He said that this reputation was a treasure of priceless value; that under Providence its value had now become inestimably enhanced, for the recent episode has spread this fame far and wide, and thus had focused the eyes of the American world upon this village, and made its name for all time, as he hoped and believed, a synonym for commercial incorruptibility.
By now, the reader knows just how deep the moral rot in Hadleysburg goes—every single one of Hadleysburg's nineteen prominent citizens has laid claim to the gold, a crisis that Burgess will shortly discover. Each new instance of hyperbole in this speech—that divine "Providence" herself has "enhanced" the treasure, that Hadleyburg will become immortal in its reputation of "incorruptibility"—just serves to raise the reader's anticipation of the Nineteen's collapse and the world's realization of Hadleyburg's true nature.
"The Man That Corrupted Hadleyburg" is ultimately a tale of revenge—one stranger's revenge on the town that once wronged him—and by drawing out the climactic revelation Twain ropes the reader along in the stranger's quest. Both the reader and the stranger are outsiders in this story, and they can only sit back and watch as everything begins to collapse.