The folks who join Starfleet are a bit insane anyway. In a population of trillions, it shouldn't be that hard to find a few million volunteers for unpaid work fraught with deadly dangers. Hey, they find suicide bombers in sufficient numbers in our reality, too!
As for the few examples of purchases of luxury items or services in Star Trek, there tends to be a very poor correlation between such activity and the working income of the purchaser. Luxury tends to be bought by people who don't really have to work for their money!