The cost of production of any game console is a function of time.
When a console first comes out, it typically costs more than the sale price.
In the case of Sony, who's willing to take big risks, it can cost a LOT more.
For Nintendo, who doesn't like big risks, it's just a little more.
Over time, manufacturers spend a great deal of effort (both in engineering and by negotiating with suppliers) to cost-reduce the consoles. Usually within a year, they reach the point of breaking even or possibly making a tiny profit on hardware.
When consoles are reduced in price, they're usually still breaking even at the new cost, but sometimes it may be close (a slight loss until the next cost reduction step).