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.