Bands/acts do almost always get paid for free events in various ways, depending on the event and how organised the act itself is. It’s all pocket money sums but that can make the difference between being able to afford to perform and not.
Acts usually get paid a small fee, depending on how the concert’s being funded. Sometimes they might get nothing, sometimes they might get a decent sum. They’d also usually get vouchers for food vendors and the bar, if there is one, and most of the time organisers will rustle up free accommodation for out of town acts (I’ve had so many random bands stay at my flat), and sometimes they’ll pay some travel expenses. It varies a lot. Obviously that’s not worth much, but at least it helps mean you’re less likely to be out of pocket from playing the event.
Bands also usually sell their own CDs and possibly merchandising at those concerts. Even if you only sell 20 CDs at a fiver each that’s £100. Merch can be very cheap to get made, and, if either you are good or your merch looks good, you can make a bit of pocket money from it. One band I knew wasn’t that great musically, but they’d designed their own t-shirts and badges/pins, and they were really nice, and they made a bit of money from that. Not paying the rent type of money, but it was something, at least.
In addition, songwriters get paid a tiny bit of money (for free events at parks it really is very tiny) from the performing rights society in the UK each time their song is played in public, including them playing it themselves at concerts, and there’s a similar organisation in the US, about which I don’t know the details of payments.
In the UK, for small bands, for the PRS, you don’t get any money automatically, you don’t get any money for cover songs (when performed live; you do for various other “performances” like records/CDs and digital downloads, where you get mechanical rights) and you have to register as the songwriter, but you can submit your own setlist if the venue doesn’t do it for you, and get a payment for each song depending on its length and various other complicated factors like venue size (you also get a tiny money from busking and open mics that way). The venue doesn’t pay a lot of money to the PRS for free events, but the money the songwriter gets doesn’t depend on the amount the individual venue pays the PRS. Because there’s no entry fee you might get nothing or you might get something, depending on the type of event. It really is really complicated, which is why some small bands don’t bother paying to register. That’s why I mentioned how organised the band is as being a factor. Such small bands probably can’t afford to pay someone to do this for them.
That’s all for the really small bands who aren’t anywhere near making it into even the indie charts. For major or majorish acts the free event might be a publicity event for their latest single or album, and they might make money from merch, or if it’s for a charitable cause, which many free events are, they’re not doing it for the money anyway.
ETA: I’ve never seen a band solicit tips, but I’ve never performed in the US, and the situation might be different there.
Source: I used to be in a band, definitely a very minor one, sadly.