The moral has to do with the nature of imprisonment. While the terms of the bet assume that being imprisoned in a cell is a kind of terrible punishment, the story suggests that, in fact, everyone is a prisoner of society and their own desires and that being locked up is the only way to be truly free.
The story begins with the party the banker throws, at which a fierce debate ensues about which sentence is more humane: life imprisonment or execution. One young man, a lawyer, declares that life is always better than death. The banker counters that the young man probably could not endure five years of solitary confinement. The young man responds by proposing a wager: if he can endure confinement for fifteen years, the banker will pay him two million.
The bet does not turn out as expected. For fifteen years, the young man studies everything he can get his hands on, in effect living entire lives vicariously through his reading. The banker, on the other hand, continues his profligate lifestyle. For fifteen years, he continues to speculate on the stock market and sees his debts begin to mount. As the lawyer's sentence is about to expire, the banker realizes that he would be ruined should he lose the bet and have to pay out the two million.
In an act of desperation, the banker visits the man in his cell. While the prisoner is asleep, the banker finds a note that explains that, far from being uplifted by his intense study, the lawyer has concluded that human knowledge is pointless and that he will renounce the two million he is owed. Later, the lawyer, who was always free to end his captivity whenever he chose, disappears just before the fifteen years are up. The banker, on the other hand, relieved to be free of the bet, takes the note and locks it up in a safe.
The banker is the true captive in this situation. The prisoner's note only has meaning in that it releases him from the bet. The "imprisonment" of the note in the safe at the end of the story is an ironic moment that underscores how the banker is a prisoner of his own fears and desires.