Buying isn't always the best option but don't forget about potential appreciation and tax write-offs in your financial decisions.
From there, you can start stacking additional costs and savings on both sides of the argument. I've done that math, too, and found that, at least in my area, that only makes buying look even worse.
That said, in a lot of places (e.g., small towns and suburbs), it's slim pickings for apartments that aren't basically bachelor pads or eyesore cookie cutter developments. If I didn't live in a major metro area, I'd probably be buying, too.