I think there are a few things that make it possible. Boston is thriving in technology and pharmaceutical industries even through a recession, so there is more money to be spent at games.
Boston (and New England in general) also has a ton of high level private colleges, which means that people come into the city for school, turn into a Sox fan, and leave the area after they graduate-- staying a sox fan. And despite so many schools, Boston College is really the only big football team that anyone cares about, and UCONN is the closest thing New England has to a big basketball team.
Its also probably worth noting that the richest two baseball cities-- New York and L.A. have two teams. You should also note that several of the most populated cities are in very warm places that probably have far more oppressive weather throughout the summer-- San Diego, Phoenix, San Antonio, Houston, Dallas, which probably affects attendance. Summer in Boston is not so bad.