There's a number of reasons:
1. As mentioned, the hardware is differnet in every PC, as compared to consoles. As such, optimizing must be done through most possible configurations. Otherwise, the game runs badly on a PC's hardware that's better then the console the game was built on. Look at pretty much every console -> PC Ubisoft port (Devil May Cry 3 is a big example).
2. Piracy. PC games are pirated more then any console. Sure, consoles have their fair share of piracy, but it only takes an ISO and two programs to run a pirated game PC game.
3. Style restirctions. Unless you have a gamepad, PC games are only really confortable with shooters, strategy games, and some RPG's.
4. Sales. Not everyone has a gaming quality PC. Back in the SNES / Genesis days, almost any PC could run any game. As of around 2002, you needed a computer actually meant for gaming. Not just anything would do. Although really, most office style computers nowadays are just short a graphics card from gaming. hence, there isn't as big an audience to sell to.
5. Price range. You can build a good gaming computer for around $500+. Ina console gamers POV, that's about as much as a PS3.