The federal government has ended two programs that provided food to schools and food banks by buying it from local farmers.