The federal government can’t block benefits from the nation’s largest food aid program from being used to buy candy, soda and other sugary drinks, a judge ruled.