I'm not aware of it being illegal to 'food' or even 'feed' the homeless. Hell there might be gov't programs specifically dedicated to that purpose ??? I don't know, to be fair. I do know there are charitable (¿private?) programs dedicated to that purpose though.
lots of cities have laws that criminalize just existing if you're homeless. some of those cities have very hard to follow restrictions on "food sharing" if the person you're sharing food with is homeless. giving out food to a homeless person or homeless people can get you fined in the right city if the right cop is around. those restrictions exist as a way to "drive out" the homeless without having to worry about creating affordable housing for them, more and better shelters, outreach programs, etc. of course, it doesn't work to decrease the homeless population in any of those cities because the homeless aren't there by choice.