LAFAYETTE, Tenn. — As city governments and schools across the country move to ban or restrict the use of electronic cigarettes, one place increasingly welcomes the devices: the rural county jail.

Though traditional cigarettes are prohibited from most prisons and jails because of fire hazards and secondhand smoke, a growing number of sheriffs say they are selling e-cigarettes to inmates to help control the mood swings of those in need of a smoke, as well as address budget shortfalls, which in some jails have meant that guards are earning little more than fast-food workers.

The trend stands in contrast to restrictions on e-cigarettes approved in Chicago, New York, Los Angeles and other big cities. County jails in at least seven states have permitted the sale of a limited selection of flavors of e-cigarettes to inmates. They have quickly become one of the most sought-after items in jail commissaries. And although federal prisons ban e-cigarettes, the inmate market has so much potential that Chinese and American manufacturers now produce “jail-safe” versions made of plastic instead of metal.

In Gage County, in southeastern Nebraska, Sheriff Millard Gustafson said that he had sold out of the 200 e-cigarettes bought in December for the 32-prisoner jail, but that more would be arriving soon. “They’ve been selling like hot cakes,” he said. “I look at this as something to control their moods. And so if they’re not a good boy or girl, I’m going to take them away, just like I do with the TVs.”