When Maryland state and county officials arrived in this beach town for their annual summer conference four years ago, they were greeted by a remarkable display: Signs posted at one hotel after another on the main drag with messages such as “No Slots in Maryland. Period.”

The scene this month was far different. The Casino at Ocean Downs, which opened its doors in January just five miles from the conference site, supplied beer cups bearing its logo at the event’s biggest draw, a crab feast attended by Gov. Martin O’Malley and hundreds of other officials from across the state.

The reception has been far friendlier than most anyone expected as the first beach season with a casino here nears its close. Even some opponents of allowing slots at the six-decades-old horse track concede that their worst fears about increased traffic and the undermining of the town’s family-friendly atmosphere have not materialized.

“There’s been a real change of heart,” said Melanie Pursel, executive director of the Greater Ocean City Chamber of Commerce, which took a formal stand against slots before the legislature and Maryland voters authorized five facilities across the state. “The attitude now is, since they’re here, let’s work with them.”

The chamber’s primary concern had been that a slots casino would mean less money spent by beachgoers on hotels, restaurants and other attractions. In its eight months of operation, the casino has sought to steer some money in the opposite direction, listing several local hotels on its Web site and offering its patrons gift certificates to nearby restaurants.

“We see ourselves as just another amenity, something that complements the other attractions here,” said Joseph Cavilla, general manager of Oceans Downs, where, at least until the threat of Hurricane Irene, business saw a sharp uptick after the summer beach season got into full swing.

The detente with the surrounding community comes as another debate brews over gambling in Maryland, this one over whether to allow slot machines, table games or both at Rosecroft Raceway in Prince George’s County. Rosecroft, which is in Fort Washington and had been shuttered for more than a year, reopened last week for betting on simulcasts of harness races.

Both Ocean Downs and Rosecroft are harness-racing tracks adjacent to wary, or once-wary, residential communities. Rosecroft’s new owner, Penn National Gaming, has pledged to bring back live racing in October and has made no secret of its plans to ask the legislature next year to allow additional gambling there.

In Rosecroft’s case, the most vocal local opposition has come not from the business community but from religious leaders. Last month, a group of 36 ministers and others pledged in a letter to O’Malley to vigorously fight Penn National’s plans.

Gerry Evans, an Annapolis-based lobbyist for Penn National, said he sees several lessons from the experience at Ocean Downs. Chief among them, he said, is the value of “good old-fashioned perseverance” against opposition that he characterized as coming from “a small, vocal and ultimately not very compelling” group.

“At the end of the day, the undeniable logic becomes too hard for the legislature to resist: that there are gamblers from Maryland who are taking their dollars somewhere else,” Evans said.

But there are also important differences between what emerged at Ocean Downs and what is envisioned in Prince George’s. Penn National is contemplating a casino similar in size to the one planned for an outlet mall in Anne Arundel County. With 4,750 machines, the Anne Arundel site would be the state’s largest — and its owner sees Rosecroft as a threat to be stopped.

In contrast, William Rickman, the developer who owns Ocean Downs, chose to put in only 800 slot machines — about a third of what the legislature authorized. His is among the smallest casinos planned in Maryland, and its quaint nature is arguably among the reasons opposition has waned.

On a recent Thursday night, the atmosphere was not unlike that of a minor-league baseball park as a crowd that included many young families filed onto a long bricked patio at Ocean Downs to watch 10 races.

As adults sipped beers and compared wagers, children scurried down toward a low fence that separated them from the Standardbreds that circled the half-mile oval. Several families parked strollers next to the red metal benches on the backstretch.

What used to be a grandstand behind them is now the casino. Signs are posted on each door informing patrons they must be 21 to enter, and security guards stand inside.

The gaming floor, which is anchored by an octagon-shaped bar, features a wide variety of new­fangled slot machines, with video screens rather than traditional reels. There are also electronic blackjack and roulette games.

The casino also offers a modest-sized dining area, dubbed the Dine ‘N’ Dash, that offers cafeteria-style fare. Cavilla, the general manager, insisted that “it’s not fast food,” pointing to a beef tenderloin sandwich that was the night’s special.

The concerns of the Ocean City business community have made some amenities found at some larger, more upscale casinos impossible.

In response to the business community’s issues, one of two slots bills passed in 2007 said that the racetrack would not be permitted to build a hotel within 10 miles of its casino. Nor could anyone build a conference center, convention center, amusement park or miniature golf course — or stage live music, dancing exhibitions or any other forms of live entertainment.

The legislation made only two exceptions: fireworks, which were already an occasional feature at Ocean Downs, and “a single piano that is played by an individual.”

Revenue at the casino has lagged behind the state’s original projections, in large part because of Rickman’s decision to set up fewer slot machines than the law authorized. But the tourist season has provided a boost. Revenue in July was $5.3 million, up from $3.8 million the month before.

Of the $5.3 million, $2.6 million went to the state, while local governments got nearly $300,000 — no doubt part of what has made the casino attractive to local officials.

Not everyone is completely sold, however.

Mark Leiner, a restaurant owner who was president of the Greater Ocean City Chamber of Commerce at the height of its opposition to slots, said he is not convinced of the merits of funding government with gambling revenue.

“Right now, it seems like, wow, it’s generating money and all the politicians are happy,” said Leiner, whose restaurant, the Bonfire, boasts of a “renowned all-you-can-eat buffet” with seafood, steaks, crab legs and ribs. “But who knows how long that will last? It’s the test of time that really determines whether these things are viable. I’m trying to keep an open mind.”

Sen. James N. Mathias Jr. (D-Worcester), whose district includes Ocean Downs, is among the politicians who says he’s rooting for the success of the casino, which has created more than 200 jobs.

Mathias, a former mayor of Ocean City, has had very mixed feelings about the project. In 2007, as a member of the House of Delegates, he voted against one of two bills needed to make slots a reality.

But now, Mathias said, “I want success for them so they can continue to create jobs. It’s here, and it’s a reality.”

Mathias and others said one reason opposition has waned is the casino’s location. It’s off a road accessible to the two main thoroughfares into Ocean City, but it’s not visible from either.

“It’s not like it’s right up there on the pier,” Mathias said. “You’ve got to make a decision that that’s what you want to do.”

Residents of Ocean Pines, a community of nearly 8,000 homes off the road that leads to the casino, were wary of increased traffic, among other things, before the casino was built. Additional turn lanes were added at the casino owner’s expense.

Tom Terry, president of the homeowners association, said there have been limited traffic issues and no other real problems to speak of.

“We have some people who are for gambling, and some people who are against gambling,” he said. “But all in all, they’ve been a pretty good neighbor.”