The moves by dozens of states to restrict what their residents can buy with the food assistance program’s benefits follow years of lawmakers petitioning the federal government for similar strictures.