The raw density numbers are misleading. Somerville has a relatively low proportion of commercial real estate. It's also a small city. Carve up Boston into Somerville sized chunks and you can beat Somerville. Roxbury and Roslindale do a number on the average density.
For purposes of comparison it might make more sense to take the total floor area and divide it by the municipality's area, subtracting out things like lakes.
For purposes of comparison it might make more sense to take the total floor area and divide it by the municipality's area, subtracting out things like lakes.