CHESAPEAKE BEACH — Doug Raines likes to travel by boat to his favorite gambling spot. He ties up at a marina outside Abner's Crab House and finds a seat in the "game room," where he pumps cash into one of the establishment's 100 slotlike machines.

"I just come here for a good time," Raines, 53, said on a recent weekday. He pushed a button on a gambling terminal themed after the popular movie "Hangover." He bet a dollar, lost eighty cents, then played again.

The restaurant is one of four in this bayside town in Southern Maryland that also functions as a miniature casino. Three aging "bingo halls" in Anne Arundel County offer similar gambling opportunities. All seven were supposed to shut down this month under a state sunset provision passed in 2009.

But in the waning days of this year's General Assembly, as politicians were locked in a debate over expanding Las Vegas-style gambling to the banks of the Potomac River, the legislature quietly passed a law that will let six of the seven continue to operate indefinitely.

The measure marked a 180-degree shift for the Assembly, which initially wanted to wipe out these small gambling sites to clear the landscape for Maryland's five voter-approved casinos.

But state and local officials became used to the tax revenue the places produce. The mini-casinos hired lobbyists. And the governor and the General Assembly decided to legalize them permanently, the latest embrace of gambling in a state that fought it for years.

"There are a lot of state laws where you don't remember exactly how they got started," said Del. Justin D. Ross, a Prince George's CountyDemocrat on the House Ways and Means Committee, who oversaw the House version of the bill. "In this case, it is a small program and brings in a fairly substantial amount of money for the state. People are comfortable with it staying."

Sen. Ed DeGrange, the Anne Arundel Democrat who sponsored the bill, said he wanted to help establishments that "had been in business for years and years. ... They give to a lot to charities. Plus, they do generate income and taxes to the local government."

The six facilities contributed about $14 million to the state's coffers last year, according to records from the Maryland comptroller's office. In part because the sites will keep some customers away from Maryland's voter-approved gambling program, the net benefit to the state to keep them open is estimated at $9.5 million.

Sen. Brian E. Frosh, a Montgomery County Democrat, was one of four members in the upper chamber to vote against the bill. "This seemed like another gambling expansion, and I wasn't convinced that it made sense," he said. "I thought it was safer to vote against it. It just looked funny to me."

Technically, the terminals operating in the little restaurant-casinos are not slot machines. The difference is hardly detectable without cracking open the machines and examining their innards.

From the owners' perspective, they bring in profits on par with slot machines. Last year, three facilities in Chesapeake Beach togethermade $28 million — earning about $165 per day per machine — about the same return as at the Ocean Downs Casino near Ocean City. At the Anne Arundel County bingo halls, the return per day comes to $150 per machine.

There is one major difference between these small operators and the state's big slots casinos: The tax rate. Operators at the state's voter-approved casinos — three are open, at Arundel Mills, Ocean Downs and in Perryville — pay a 67 percent tax on revenue from their slot machines. The mini-casinos in Calvert and Anne Arundel counties pay about half that.

Del. Michael D. Smigiel, an Eastern Shore Republican, said the difference in tax rates between the small operators and the casinos "doesn't seem fair." He was one of 20 members to vote against the bill in the House of Delegates.

In Chesapeake Beach, population 5,700, the four mini-casinos are located in a three-block stretch. Legislators decided that the machines in one, a sports bar, were too similar to slots. Those machines were scheduled to shut down July 1, but an Anne Arundel County circuit judge granted an injunction allowing the gambling facility to stay open pending a hearing this week.

A tourist in Chesapeake Beach would never know there was slots-style gambling in the town. None of the places has a sign hinting at the rows of machines within. The three allowed by the legislature include only discreet "gaming" information on their websites, no promises of payola or flashing lights.

"We don't really advertise," said Jim Luckett, owner of Traders Seafood and Steakhouse, a family-style restaurant with about 80 machines in a side bar. "It is just word of mouth. We try to stay low-key."

Traders and Abner's each followed a path blazed by Rod 'N' Reel, the biggest operator in Chesapeake Beach, with more than 250 machines split into three gambling rooms (including one dockside). It is owned by Gerald Donovan, who for many years was the mayor of this small tourist town.

His bar had a history of gambling: It kept 78 full slot machines from 1948 to 1968, when they were legal in Southern Maryland. (During the heyday, Anne Arundel and the three Southern Maryland counties had about 5,000 slot machines. The area was the second-most-saturated part of the country after Las Vegas.)

Donovan argued that his machines were not slots, then illegal in Maryland, because they contained paper reels of tickets. Winners were predetermined, even if the players didn't know when the winning ticket would arrive. With a slot machine, he said, the winner is randomly determined at the moment the gambler pushes the play button.

The state's highest court upheld that theory in a 2001 ruling, and slots-type parlors started popping up across the state.

In November 2007, the General Assembly met in special session and passed legislation authorizing a statewide gambling program of five casinos. The measure was placed before Maryland voters in a referendum in November 2008. Lawmakers decided it made sense to look more closely at the cottage industry of mini-casinos. They started by establishing a 20 percent tax on proceeds.

During the 2008 General Assembly session, with the state's full-fledged gambling program heading to voters, Sen. Thomas "Mac" Middleton pushed legislation to close the mini-casinos. The Southern Maryland Democrat remembered his father betting away hundreds of dollars from the family's wheat crop. His bill gave the mini-casinosa year to wind down operations.

Senate President Thomas V. Mike Miller agreed, and took the rare step of testifying personally in support of Middleton's bill. It was an unusual position for Miller, typically a supporter of gambling.

The Middleton bill became law.

Miller declined through a spokeswoman to comment for this article. An aide explained that Miller favors gambling when the state controls it and taxes it.

During the debate, some of the mini-casinos had hired lobbyists. The most lucrative contract went to Gerald E. Evans, a longtime Miller ally.

Instead of shutting down the establishments after one year, the General Assembly voted in 2009 to give them three more years in business, requiring them to close on July 1, 2012. It alsoincreased the tax rate from 20 percent to 30 percent.

But this year, DeGrange introduced a bill to get rid of the sunset — and to slightly increase the tax rate on the Calvert County facilities. The bill passed with little attention, though local officials say they were watching closely.

"It is a very significant source of revenue to the town," said Bruce A. Wahl, the mayor of Chesapeake Beach, where 10 percent of the budget came from gambling last year.

Passage of the bill meant that Evans was successful on behalf of his client the Rod 'N' Reel, which since 2007 has paid the lobbyist at least $409,500, according to state records.

Besides letting the establishments stay open, the new law moves all of the machines under the regulatory umbrella of the State Lottery Agency, which also oversees Maryland's voter-approved casinos. While the Anne Arundel machines have long been subject to strict oversight from a county gambling commission, the Calvert ones have not.

With their futures secure, the threeChesapeake Beach gambling facilities are making plans. The Rod 'N' Reel, with its 286 machines, plans to upgrade its gambling rooms, said Mary E. Landham, head of gaming for the facility.

And, she said, it is creating a players reward program to build loyalty. Just like the Vegas casinos.