It's getting ever more expensive to buy a home, as the median price of an existing home has hit a new all-time high—and is likely to keep rising.

Buyers shelled out a median $267,500 for an existing home (one that has previously been lived in) in May, according to the most recent National Association of Realtors® report. That is up nearly 3% from April and represents a 5.2% annual rise.

“It’s Economics 101: Demand from buyers is high, and the number of homes for sale is pretty limited," so prices are going up, says Chief Economist Danielle Hale of realtor.com®. “Especially for entry-level homes in move-in ready condition, buyers can expect lots of competition, potential multiple offers, bidding wars, and homes that sell quickly.”

Despite the high price tags, existing homes are still a bargain compared with newly constructed ones. The median price of a brand-new home was $312,400 in April—almost 16.8% more than an existing home, according to the most recent data available from the U.S. Census Bureau and the U.S. Department of Housing and Urban Development.

Nevertheless, rising costs may also be responsible for the dip in sales. The number of closings fell 0.6% from April to May and 3% year over year to reach 4.81 million. Realtor.com looked only at the seasonally adjusted numbers in the report. These have been smoothed out over 12 months to account for seasonal fluctuations.

The South, where the median price was $239,400, saw the most sales, at 2.03 million in May. Closings were down 0.5% from April, but flat from a year ago.

Next up was the most affordable region, the Midwest, where there were 1.18 million sales. That was down 2.5% both month over month and year over year. The median price was $211,800.

In the West, the most expensive region, there were 1.02 million sales, down 1.9% from April and 3.8% year over year. Prices soared in the region to $399,800, rising 7% year over year.

Finally, in the Northeast there were 580,000 sales, up 5.5% from the previous month. However, sales were down 12.1% compared with the same time last year. The median price in the region was $274,100.

“Incredibly low supply continues to be the primary impediment to more sales, but there’s no question the combination of higher prices and mortgage rates are pinching the budgets of prospective buyers, and ultimately keeping some from reaching the market," NAR's chief economist, Lawrence Yun, said in a statement.

Rising costs are also hampering homeowners who would like to use the home equity they've built up to move into larger, nicer abodes.

"While [sellers are] thrilled that they will immediately find multiple buyers interested in their listing, many fear they’ll have extreme difficulty finding another home to buy," NAR President Elizabeth Mendenhall said in a statement. "Some have even decided to hold off until inventory conditions start improving, which is actually only exacerbating supply shortages.”