Talk about misappropriating funds.

A sheriff in Alabama took home as personal profit more than $750,000 that was budgeted to feed jail inmates and used it to cop a $740,000 beach house, according to media reports.

It’s perfectly legal in Alabama, according to state law and local officials.

Alabama has a Depression-era law that allows sheriffs to “keep and retain” unspent money from jail food-provision accounts. Sheriffs across the state take excess money as personal income — and, in the event of a shortfall, are personally liable for covering the gap.

Etowah County Sheriff Todd Entrekin told reporters that he follows that practice of taking extra money from the fund, saying, “The law says it’s a personal account and that’s the way I’ve always done it.”

Sheriffs across the state do the same thing and have for decades. In most cases, the public doesn’t know how much money is involved because sheriffs do not need to report extra income of less than $250,000 a year.

In Etowah County, that cap was exceeded and the paper trail was found.

It was discovered the eye-popping figures on ethics disclosures that Entrekin sent to the state: Over the course of three years, he received more than $750,000 in extra compensation from “Food Provisions.”

It was also found that Entrekin and his wife own several properties worth a combined $1.7 million, including a $740,000 four-bedroom house in Orange Beach, Ala., purchased in September.

Without the provision funds, Entrekin earns a little more than $93,000 a year, the paper says.

In a media statement, Entrekin said the “liberal media has began attacking me for following the letter of the law.”

In 2009, while he was still in debt from paying for inmates’ food, Entrekin said that he personally thought the law needed to be changed, but he noted that it might cost more money for taxpayers if the county commission had to manage jail kitchens through an open bid process.

David Akins, the chief administrative officer of the Etowah County Commission, agrees with that assessment. He says the commission is not eager to take on that duty, as some other local governments have done.

“The sheriff can feed inmates cheaper than the county can,” he said.