Alabama’s governor has begun to cut off a gravy train for the state’s sheriffs: the unspent money for prisoners’ meals that the sheriffs have long been allowed to keep for themselves.

The practice, born of a bickered-over ambiguity in a state law, has let sheriffs pocket tax dollars that over the decades almost certainly ran into the millions. To curtail the practice, Gov. Kay Ivey ordered in a memorandum to the state comptroller that payments of certain funds related to jail food “no longer be made to the sheriffs personally.” Instead, the governor wrote, the money must be paid to county general funds or official accounts.

“Public funds should be used for public purposes,” Ms. Ivey, a Republican, said in a statement on Wednesday. “It’s that simple.”

Critics of the practice welcomed the governor’s action on Wednesday but said it resolved only part of the problem because it did not apply to every type of payment related to jail food.