There are many ways to forage free food in Mexico, some trickier than the others.
A rumor says that you can dumpster dive at local Walmart stores. Other than that dumpster diving in supermarkets is next to impossible because one or more of the three reasons: a) practically nothing goes to waste usually, b) the bins are nowhere to be seen and c) stuff rots in the heat quickly.
Open-air markets (mercados) and smaller vegetable and fruit vendors are, however, a source of plenty. Interestingly enough, if you ask “Tienes algo para tirar” (“Do you have anything to throw out”) they usually say no, either because they don´t understand what you want or because they feed their family with the second-grade stuff. It´s better just to dig straight into their waste basket and you are sure to get their attention. You can ask “Es basura? Puedo/podemos tomar algo?” (“Is this trash? Can I/we take some?”) and in 99% of the cases they have no problem with that. Sometimes they even bring you more stuff.
Mexican restaurants are from being under-staffed so you have to be real quick if you wish to get your claws on whatever is left from other customers. Plates are collected immediately. What you can do is either to run after the waiters and ask them if you can eat what is on the plate or, better, to solicit a quick meeting with the manager (patron) and ask her (in 80% of the cases the bosses are women) if you could have something free to eat (“Tienes algo gratuita para comer?”). Most likely they will give you something to eat. If you ask for leftovers (“Tienes algo que vas a tirar?”) they probably say no because they do throw leftover food immediately in the bin and it´s all mixed and ugly.
They usually sell the second-grade stuff the next day on a reduced price but if you ask you probably get a sweet bread or two.
Luckily the fruits of Mexican nature are plentiful. Enjoy the mango, the chaya, the icaco and the coconut, among others!
At least in Mexico City there is an organization that serves free lunch Monday-Friday to those in need. It´s the tall colorful building (5th floor) right next to Metro Colegio Militar.