Last year, after more than 30 attorneys general began investigating deceptive advertising by 5-Hour Energy, the caffeinated drink, the company hired Dickstein Shapiro, a national law firm that has a large practice dedicated to lobbying attorneys general. The firm has given at least $730,000 to their campaigns in the last five years, and executives of the drink company have given more than $280,000. Dickstein began working on attorneys general one by one, and had success: In Missouri, Attorney General Chris Koster pulled out of the investigation after being pressured by a Dickstein lawyer at a fund-raising event held at the Loews Santa Monica Beach Hotel in California.

Mr. Koster, a Democrat, has also been the subject of successful lobbying campaigns by two other Dickstein clients, Pfizer and AT&T, and is now the subject of a legislative investigation into his actions. He has denied any wrongdoing, and on Wednesday announced that he would no longer accept donations or gifts from lobbyists, or from the subjects of his investigations.

The attorney general of Florida, Pam Bondi, a Republican, has accepted nearly $25,000 in airfare, lodging and meals to attend meetings of the Republican Attorneys General Association, all of which was paid indirectly by corporate donations. At these meetings, she regularly met with lobbyists for industries that she regulates, and she has dropped several investigations into clients represented by Dickstein. Last year, after Ms. Bondi took a free ride to a resort that was paid for, in large part, by Dickstein, she invited one of the firm’s lobbyists to stay at her home while recovering from surgery. The Florida Commission on Ethics is investigating whether Dickstein illegally lobbied Ms. Bondi, because it is not registered as a lobbyist in the state.

The Times investigation showed that lobbyists have written draft legal filings that were used by attorneys general in court cases, and have even done legal work for their offices. At least one attorney general — Bob Ferguson of Washington State — personally solicited a donation from 5-Hour Energy after joining the investigation against the company, leading the company to complain that it was being shaken down for money.

For state lawmakers, fixing this mess will have to go beyond investigating individual cases. State lobbying laws will have to be expanded to cover attorneys general; already, many states barely police gifts to legislators. (Ten states allow officeholders to take gifts of unlimited value.) States also need to put lower limits on how much a donor can give to an attorney general’s campaign, or even consider making the job an appointed position, as it is in seven states. Big-money politics should not mix with state legal power.