Despite criminal charges of stealing public funds, troopers caught up in the widespread overtime scandal at Massachusetts State Police cashed in on a nice taxpayer-funded perk, the NBC10 Boston Investigators discovered.

Earlier this year, a handful of veteran law enforcement officers abruptly retired while under investigation. Once the paperwork was filed, they collected thousands of dollars for unused vacation and sick time accrued over the course of their lengthy careers.

For instance, consider the payout for former Lt. David Wilson, who’s currently facing federal and state criminal charges.

When he retired in March, Wilson cashed out more than 10 weeks of vacation and 418 sick days. His check from state taxpayers: $80,361.84.

“This is a loophole where someone can rush in during an investigation and take the money,” said Greg Sullivan, research director at the Pioneer Institute. “This should not be allowed to happen for people under investigation for serious financial fraud and theft of state taxpayers’ money.”

The NBC10 Boston Investigators added up the payouts for six former troopers who have been criminally charged in the overtime probe, a tab of nearly $273,000. Two of the retired troopers, Paul Cesan and Daren DeJong, already have pleaded guilty to federal charges.

With more indictments anticipated, state payroll records show the rush to retire has ballooned buyouts at State Police to $5.3 million this year. In past years, the department has averaged about $3 million to outgoing employees for unused vacation and sick time.

“Those are the kinds of things that affect taxpayers,” said Massachusetts Inspector General Glenn Cunha. “An agency will have to cut back on services because they are making these huge payouts upon retirement and haven’t limited their exposure by reducing the amount employees can accrue.”

The top two commanders of the State Police also collected large payouts when they retired in the wake of the “Troopergate” scandal in late 2017.

Former Col. Richard McKeon and former Dept. Supt. Francis Hughes collected nearly $300,000 in combined unused vacation and sick time.

However, Cunha told NBC10 Boston the problem extends well beyond State Police. His office recently crunched the numbers and calculated state taxpayers are on the hook for $558 million of unused vacation and sick time liability.

“I really didn’t think it was that high. I was shocked,” he said.

It’s why the Inspector General recommends capping the amount public employees can stockpile. Right now, state workers can accrue 15 sick days per year.

The state watchdog estimates there are more than 10,000 workers who have banked at least 1,000 sick hours. About 6,000 employees have accrued well over 10 weeks of vacation.

Cunha questions the accuracy of the accrued amounts because his office has found sloppy attendance recordkeeping at state agencies.

“These are employee benefits. They aren’t supposed to be retirement benefits,” he said.

Gov. Charlie Baker previously proposed capping the amount of sick time employees can accrue at 1,000 hours. He told NBC10 Boston that amount makes sense because the state doesn’t offer a short-term disability policy.

But he believes in reigning in the benefit because the concept is unheard of in the private sector.

“An unlimited amount doesn’t make sense,” he told NBC10 Boston’s Ryan Kath. “In the grand scheme of things, capping it is good because it’s consistent with the people who pay the bills.”

The NBC10 Boston Investigators learned sick time can be withheld if a state employee is terminated. However, State Police spokesman Dave Procopio said the troopers were not subject to discharge when they retired because the investigation was ongoing.

NBC10 Boston asked Baker if there should be a mechanism in place to withhold buyouts until investigations are complete.

“I think that might make for an interesting adjustment,” Baker responded. “If people are found guilty, I don’t believe they should get their pensions and I think it’s totally appropriate to incorporate this into the conversation as well.”

The retired troopers are currently receiving their pensions, but risk losing them because of a state law that strips those benefits for employees convicted of crimes related to their public positions.

However, there is nothing in place to refund taxpayers for the unused sick time payouts.

“The public is being taken advantage of,” Sullivan said. “This is crazy. It shouldn’t happen.”

Ryan Kath can be reached at ryan.kath@nbcuni.com. You can also follow him on Twitter or connect on Facebook.