Microsoft and Sony get a cut of every game sold for their platforms, while the consoles themselves are sold for a loss, at least at launch. That's how it has worked for the last two generations and I think it's the same this time around.
The exception is Nintendo, who sold the Wii (and presumably the Wii-U) for a small profit.
The exception is Nintendo, who sold the Wii (and presumably the Wii-U) for a small profit.