Maryland state lawmakers running for Congress and local office are exempt from the state’s ban on fundraising during the annual legislative session — enabling them to take money from lobbyists and others with business before them.

State lawmakers competing in those races took at least $33,000 from lobbyists and executives of groups trying to sway government officials during the legislative session, according to an analysis of campaign finance and lobbying records.

The donations are legal and just a sliver of a multimillion-dollar haul, but they raise concerns from good-government advocates who say they violate the spirit of the fundraising ban, which aims to insulate legislators from undue influence.

“This is a serious loophole in the law,” said Jennifer Bevan-Dangel, executive director of Common Cause Maryland. “The ban exists for a reason. The purpose is to make sure, when our legislators are down there for 90 days, that they are hearing the constituents’ voices above anyone else.”

State Sen. Catherine E. Pugh (D), the front-runner in the mayoral race in Baltimore, has accepted at least $18,000 from lobbyists and groups with interests before the legislature during the 90-day session. (Marvin Joseph/The Washington Post)

Senate Majority Leader Catherine E. Pugh (D-Baltimore) clocked in as the biggest recipient of lobbyist dollars during the session, with at least $14,600 poured into her bid to be Baltimore’s mayor. She also took at least $3,800 from representatives of organizations affected by legislation.

A spokesman for Pugh says she does not personally solicit these donations, although lobbyists are invited to fundraising events.

“Many lobbyists make contributions because they want to see an effective mayor serve in the city of Baltimore,” said spokesman Anthony McCarthy.

In March, rival Baltimore mayoral candidate Elizabeth Embry attacked Pugh for these donations. Embry’s campaign released an analysis noting that a number of the lobbyists who donated to Pugh testified before the finance committee on which Pugh serves, including super-lobbyist Gerard Evans, who gave her $2,000 days after testifying on a Baltimore Orioles ticket policy.

Evans says it’s “ridiculous” to think there is anything unseemly about lobbyists donating during the legislative session, or that it amounts to a quid pro quo.

“I’ve watched some of these people literally grow up, and I’ve known them for a long time, and they become your friends,” said Evans, one of the top-paid state lobbyists, who also donated to two lawmakers running for Congress. “Fortunately, Annapolis is not a money-driven place.”

At least 29 states have some sort of prohibition on campaign fundraising during the legislative session, but state laws generally do not apply to federal races.

Assessing conflicts of interest with campaign contributions is something of a chicken-or-the-egg question. Some donors say they’re financially backing politicians whose views align with their interests, while critics contend that donations provide access to lawmakers.

Take the example of state Sen. Jamie B. Raskin (D-Montgomery), a leading candidate in the 8th Congressional District race who prides himself on being a good-government reformer not beholden to corporate lobbyists.

He accepted $2,450 from the Humane Society of the United States’ affiliated PAC and executives during a session when he sponsored two bills favored by the group, which passed the Senate unanimously. He also helped a third bill pass the Judicial Proceedings Committee.

Sara Amundson, executive director of Humane Society Legislative Fund, said the group supported Raskin because he’s a longtime supporter of animal welfare.

In addition to accepting donations from the Humane Society’s PAC, Raskin took $4,100 from some of Annapolis’s most well-connected lobbyists, as well as advocates for children and victims of domestic violence.

“ ‘Lobbyist’ is not a dirty word to me. There are public-interest lobbyists all over the place,” said Raskin, who said he did not ask lobbyists to donate. “But if the money came from large corporations that were getting tax breaks in this session, I could see that being an issue.”

David Trone, a wealthy wine retailer who has put more than $12 million of his own money into his bid for the 8th Congressional District Democratic nomination, has released an ad criticizing Raskin for taking lobbying donations after telling a money-in-politics panel that he doesn’t take money from “people lobbying me.”

Del. Kumar P. Barve (D-Montgomery), also running in the 8th District race, accepted $3,300 from lobbyists and advocates. The chairman of the House Environment and Transportation Committee said that he never discusses his campaign during working hours at the General Assembly and that one-third of his donations came from a longtime friend who did not lobby him in 2016.

In the Democratic primary for the open 4th Congressional District seat, Del. Joseline A. Peña-Melnyk (D-Prince George’s) accepted at least $4,900 from Annapolis lobbyists representing a variety of interests. Her campaign manager said Peña-Melnyk is “fiercely independent” and did not hold fundraisers in Annapolis even though she legally could.

Her former rival Del. Dereck E. Davis (D-Prince George’s), who announced in early February he was dropping his bid, took several contributions from lobbying groups during the session. Weeks after ending his bid, he accepted $500 from a plastic-bag manufacturer that lobbied against a ban on its products in grocery stores. The bill received an unfavorable report from the committee he chairs.

Davis said he wasn’t familiar with the manufacturer or donation and noted his committee has opposed plastic-bag bans and taxes for years. He said the fundraising demands of running for Congress necessitate reaching out to many people — including lobbyists.

“What you don’t do is cross any lines, you don’t demand anything, you don’t unduly pressure people,” Davis said.

House Minority whip Kathy Szeliga (R-Baltimore County) held a fundraiser for her U.S. Senate bid in Annapolis attended by lobbyists, but little of the money raised that night came from them.

Dels. Ana Sol Gutiérrez (D-Montgomery) and Patrick L. McDonough (R-Baltimore County) have raised little money for their congressional bids and did not report taking money from registered state lobbyists.