Sony loses money on consoles trying to give people a good deal on what is very expensive technology so that people will enjoy the benefits years down the road.
There's no such thing as a free lunch. Sony sells their system at a loss with the belief that you'll pay them back every cent in the future, many times over.
In theory, Microsoft has the same belief, but as was stated by someone else, they seem to be running a charity.
"[Our former customers] are unable to find software which they WANT to play."
"The way to solve this problem lies in how to communicate what kind of games [they CAN play]."
Satoru Iwata, Nintendo President. Only slightly paraphrased.