Yep, borders are everything. Allston/Brighton is similar land area to Somerville (4.4 sq miles vs. 4.1) and population, so it has a similar density, but Somerville gets all the credit for being one of the densest cities in America because of borders.