The final twist in "The Bet" hinges on the idea that the lawyer took all the knowledge he could get from the many, many books he read in the prison, and turned it into wisdom. In other words, he claims that the second-hand info he gets from reading is pretty much the same thing as lived experience, so he's been there, done all of that. But he's not done. He also relies on this version of experience to decide that… experience kind of sucks. What hangs in the balance of this weird transformation is whether the reader buys it—which means we've just met a modern-day ascetic—or doesn't—which means that solitary confinement has robbed this sad man of his humanity. It's up to you, Shmoopers.
The mad scramble for random books in the last years of his confinement shows that the lawyer is trying to find a way to hang on to some part of the material world before totally giving himself over to his newfound belief system.
The main point of the story is that knowledge cannot be separated from experience, and that the world cannot be understood by someone not actually living in it.