A million dollars is a million dollars, or it's a house. I don't need a million dollars but I do need a house or I freeze to death. I can't eat a million dollars worth of food but I need to eat food every day or I die.
Gambling is seen as immoral because it's about extending your exchange value capabilities, although most people who gamble are poor as dirt and a winning bet is often about paying your utility bills and having a day out over being able to do neither (while losing bets contribute to being unable to do either).
Insurance is seen as prudent because it acts as a fail safe over your use values, be it your health, housing, employment, etc. Social security is basically a system of spreading the odds over the population, forcing everyone to do the small bets to contain the catastrophic outlier probabilities - in theory.