For most of the year, Alex Gray can't skateboard anywhere in Ocean City. Not on sidewalks, alleys or on the streets. Definitely not on the famous boardwalk. A town ordinance forbids it from April to October.

You get caught, as the 17-year-old Ocean City native did a week ago, and police give you a $100 ticket. "Laws are laws," he said they told him.

But since Thursday, the Dew Tour, the internationally recognized skateboarding, BMX and surfing competition, has set up shop on the south end of the pier for four days of games and free concerts. And the twist is, it's got city government to thank for it. With crowds expected to swell to more than 300,000, the financial rewards are expected to be huge for the town.

"We look at it as a second Fourth of July crowd," said Mayor Rick Meehan. "The larger the crowd, the greater number of hotel rooms sold, the more people in restaurants and bars. We're certainly going to see a spike in revenue."

For skateboarders, the message from City Hall is clear: We want skateboarding money, just not the skateboarders.

"How is it illegal for me to skateboard when Dew Tour is in town?" Gray asked. "It's all about money. Just think how much money skateboarders are going to make for shops and restaurants."

The six-year-old Dew Tour — which takes its name from sponsor Mountain Dew — takes place four times a year, usually in urban centers with big skating scenes, such as Boston, Chicago and Portland, Ore. Major stars in action sports participate — Shaun White and Dundalk native Bucky Lasek were in Ocean City, in addition to about 200 others — and compete in BMX and skateboarding contests.

Usually, the events take place at parking lots or arenas. Last year, one of the tour stops was the TD Garden, where Boston's Celtics and Bruins play. The event was held at Camden Yards in 2007, when it attracted nearly 55,000, and in 2008, when about 52,000 came.

But when organizers started looking for this year's first location, they wanted "a different look and feel for the venue," said tour manager Chris Prybolo. Though the tour holds winter events at resort towns such as Killington, Vt., and Breckenridge, Colo., summer resorts were considered for the first time.

There were issues: It's much harder to build on sand, and skateboarders had concerns about wind affecting their performance. Construction of the event's three stages ended up taking a little over a week and more than 100 workers each day, 75 percent of them local, Prybolo said.

But he said the benefits far outweighed the challenges. For one, crowds would be bigger, and the views would be more scenic for television — NBC is broadcasting two hours of the Ocean City competition Saturday and Sunday.

Organizers started looking at locations on the East Coast at the end of 2010 and eventually narrowed it to two: Virginia Beach and Ocean City.

Ocean City does not at first seem a natural fit for a skateboarding competition.

While it has a healthy skate culture, said Lee Gerachis, owner of Malibu's Surf Shop, it's hampered by rules that prevent teens from freely exploring the sport. It's legal to skateboard only at the Ocean Bowl, one of oldest skating bowls on the East Coast, and it's costly — about $100 for an annual pass if you're not an Ocean City resident.

"While the town hasn't been anti-skating, they certainly haven't been pro-skating," said Gerachis, who has owned his shop for 18 years. "They're still in that mentality of the '80s, when everyone was grinding on benches. And that's just not what skating is today."

Skateboarding has been banned in the streets and on the boardwalk since the 1970s because it can damage public property and because of safety concerns — for pedestrians and skateboarders, the mayor said.

But when Dew Tour organizers contacted him in late fall, he "knew we really wanted the event to happen here," Meehan said. For what would be "the largest event of its kind we've ever held in Ocean City," the benefits were obvious, he said.

"It was a good fit for Ocean City because we're built around recreation and outdoor activities," Meehan said. "Also, we knew that having an event of this magnitude would get us national exposure. It would provide those who visit a high level of entertainment and maybe expose a lot of people from outside the area to the city. We just saw it as a great opportunity to showcase Ocean City."

The mayor's pitch to the organizers was informal. In late fall, Meehan convened his department heads in his office and sat for a grilling from Dew Tour organizers on all sorts of logistical questions: construction, transportation of equipment, permits, weather, expected crowds and hotel accommodations.