I would have to say that the lawyer's initial reason for the bet was to prove his claim, but also to receive the money wagered by the banker. In the end, we can clearly see that it wasn't about the money, as the lawyer leaves early renouncing the bet. He's proved that he could live, but he's also filled with hatred and disgust at the reasons for his imprisonment. The lawyer began as an idealist, and he fulfilled his end of the bargain. Unfortunately, his final correspondence with the banker, in addition to his emaciated physical state leave us to question whether the death penalty would have been a preferrable choice.
"Your books have given me wisdom. All that the unresting thought of man has created in the ages is compressed into a small compass in my brain. I know that I am wiser than all of you.
"And I despise your books, I despise wisdom and the blessings of this world. It is all worthless, fleeting, illusory, and deceptive, like a mirage. You may be proud, wise, and fine, but death will wipe you off the face of the earth as though you were no more than mice burrowing under the floor, and your posterity, your history, your immortal geniuses will burn or freeze together with the earthly globe.
"You have lost your reason and taken the wrong path. You have taken lies for truth, and hideousness for beauty. You would marvel if, owing to strange events of some sorts, frogs and lizards suddenly grew on apple and orange trees instead of fruit, or if roses began to smell like a sweating horse; so I marvel at you who exchange heaven for earth. I don't want to understand you.
"To prove to you in action how I despise all that you live by, I renounce the two millions of which I once dreamed as of paradise and which now I despise. To deprive myself of the right to the money I shall go out from here five hours before the time fixed, and so break the compact. . . ."