Beyond the surface-level pithiness of the joke, the point is that having money may not guarantee happiness, but it makes it a lot easier to distract oneself with viscerally pleasant experiences and engage in new hobbies that may in fact lead to genuine happiness.
Robin Williams actually had a degenerative brain disease. I know a lot of the news didn't wait long enough for that information about his situation to come out, but it's on Wikipedia.