Back when I was in game dev, I really wanted to find a way to make them fun even when you lost. I never managed to grok that magic, but I did see it in e.g. Settlers of Catan.
Settlers is so fun because you really feel like you're on a journey the whole game, and while it is nice to win, you remember the interactions and experiences in the game as the valuable thing(IMO).