Sony overestimated the advantage their PS2 momentum would give them. They felt they could just put out a console and it'd sell. They also wanted to use the PS3 to help the Blu-ray format, which bumped up the cost of console significantly. Essentially they put out the console they wanted to sell, without making sure that it would be one people in general would want to buy.
They built a really good machine, which does a lot more than just play games. But (a) the up-front cost was higher than the competition, and (b) they haven't done a good job of marketing the fact that the PS3 isn't just a game console. The first bit is amplified by the economic turbulence, and the second amplifies the first even more.
There are other issues that don't help, but aren't in themselves dealbreakers. For example, the 360 is a more 'standard' architecture, and so is a little easier to develop for. The PS3 has a pretty powerful CPU but it's fairly uniquely organized and requires more familiarization to use properly. (That being said, from everything I've gathered, the PS3 is much more 'standard' than the PS2 was.)
Sony can still turn things around, and at least claim second place this generation. (The Wii has won the number one spot, no way to argue that one - Nintendo gambled and won big.) A good marketing push, a concerted effort to work with developers, and even a $50 price cut would make a big difference. But it does look like that'll have to happen this year, or else...