If you live near a city, you probably know this: It will cost you more to buy or rent downtown or in the inner suburbs compared with moving farther away.

The commute vs. affordability issue plagues many people, so the researchers at Zillow dug into their data to see where the prices spike the most for proximity to the city — and, therefore, where the tradeoff for a longer commute might mean big savings.

In 29 of the 33 largest metro markets analyzed by Zillow, buyers should expect to pay more per square foot for a home within a 15-minute rush-hour drive to the downtown core.

For home buyers, the city with the most expensive urban core is Boston, where the median home in the city is valued at 303 percent more per square foot than a typical outlying home. Washington came in second with a 218 percent premium.

The same trend is seen for renters, although the disparity between rents for close-in tenants vs. those farther out is less extreme.

Washington has the highest difference in rents, with units within a 15-minute rush-hour commute of the downtown core costing 140 percent more per square foot than rentals farther away. San Francisco came in second with a 139.7 percent premium for closer rentals, followed by Seattle at 91 percent.

For the full study, click here.