I agree with TheRandomPages. Money can't buy happiness but it can provide you with a sense of security, good medical care and a lot of those things that the average person agonizes over.
It will also buy a good therapist which can help if a person has problems with depression.
I think when people talk about the fact that "money can't buy happiness" they are thinking of wealthy people that are still searching for something in their lives. And that can certainly be the case.
If I were suddenly wealthy, I would still be troubled with occasional depression but the overwhelming anxiety about caring for myself in the future, and health care concerns etc. would be alleviated and that is huge.