Technically they make all/most of their money on the games people buy - the PS5 is just barely profitable[0] (but only at its massive scale of >20M units), and the xbox series X supposedly still sells at a $100-200 loss[1].
0: https://www.theverge.com/2021/8/4/22609150/sony-playstation-...
1: https://www.thegamer.com/xbox-series-x-s-sole-at-loss-200-do...