This is more of an anecdote as someone already linked the PS4 example, but: Sony lost on each sale of the PS3, sometimes a
lot ($300 on launch), for years. After 4 years, they still lost around $18 per unit lost[1]. It was a costly bet that ended up not working out for them as the PS3 continued to be expensive to manufacture, while also being too complicated to program effectively. (Worse ports, perceived lower performance due to SMT differences compared to the 360, etc.)
[1] https://www.cnet.com/news/sony-still-losing-on-every-playsta...