The most fun for homebuyers on a budget? Look to Maryland (© © Dennis Brack/Newscom)

Ocean City, Md. 21842 © Dennis Brack/Newscom

Ocean City, Md., a resort town about 70 miles south of Dover, Del., has long drawn large crowds with its beach, bay and hundreds of dining and nightlife offerings. A popular destination for young singles and families, the town of 10,246 people swells to about 250,000 during the summer, according to city estimates. Surprisingly, living in the middle of all this action can be affordable. Homes in the Ocean City area have a median price of $243,600, while the state median is $232,500, according to Better Homes & Gardens Real Estate and real-estate data provider Onboard Informatics.

Ocean City, also known as OCMD to habitués, emerged as the country's most affordable and fun city in a ranking by Better Homes & Gardens Real Estate's Lifestyle Search. "There are two or three ultracool cities that everyone wants to live in," says Sherry Chris, chief executive of BHG Real Estate. "The problem is it's very expensive to live in those cities, so that eliminates them as a possibility for many people." Because lifestyle and community are more important for "echo boomers," or 18- to 34-year-olds, than for older buyers, Chris says, identifying affordable places with active downtown areas and a cool atmosphere is key to attracting the current generation of homebuyers.

After Ocean City, the next most affordable and fun cities were the Ala Moana-Kakaako section of Honolulu; Tempe, Ariz.; Scottsdale, Ariz.; and Greenville, S.C.

Downtowns, colleges and resort areas
To select the country's most affordable fun places, Better Homes & Gardens Real Estate and its data partner Onboard Informatics analyzed 6,106 ZIP codes nationwide where the median home price was within 20% of the state's median. It then selected the ZIP codes with the greatest number of bars and restaurants as of July 2011. Restaurants range from chains and casual eateries to fine-dining venues, and bars include pubs, lounges and clubs, says Pete Goldey, chief information officer at Onboard.

The downtown areas of such cities as Sacramento, Calif., and Orlando, Fla., made the top 25. The list also includes several vacation areas and college towns. Tempe, for instance, is home to Arizona State University, and Wilmington, N.C., (No. 7) is home to the University of North Carolina Wilmington. Also on the list are such resort areas as Myrtle Beach, S.C., and the Wildwoods in New Jersey, as well as several cities in Hawaii.

"College towns and vacation destinations have a higher percentage of eating and drinking establishments because they are catering to a nonpermanent client base," Goldey says. These customers tend to spend more time and money "going out and being social."

Slide show:  10 most fun affordable US cities

Year-round residents
Ocean City may be bustling during warm months, but during the winter many businesses on the boardwalk close or keep shortened hours, says Donna Abbott, the town's communications manager. About three-fourths of housing units are for seasonal or recreational use, according to 2010 Census data, and only 12.8% are year-round occupied.

Also, while young beachgoers, reveling tourists and families make up a large portion of visitors, 35.3% of year-round residents are 62 or older.

Still, the promise of affordable fun — compared with pricier second-home markets in the region, such as the New Jersey shore — continues to attract homebuyers. The number of sales in Ocean City and West Ocean City totaled 503 in the first half of 2011, up 13% over the same time last year, according to data from Re/Max Premier Properties agent Nicholas Bobenko, an Ocean City native.

"There are people who gravitate here because of the people and great way of life," Bobenko says. "There is a ton of activity, it's a safe town and there's low crime." The city is also part of the Worcester County Public School District, which has a few highly ranked schools, according to

During peak season, tourists and students may help drive affordability and entertainment in some of these cities, Chris says, but "as a result there are a lot of fun things to do in the area for people who live there year-round."

Subscribe to MSN Real Estate on Facebook and Twitter.