I’ve read that it’s fraud if it’s not disclosed to the lender (which generally isn’t). The lender is being defrauded since he put up the money yet has no knowledge of the cash back.
Others have posted that lenders don’t generally allow anything more than 3% cash back to the buyer. So people do it outside of escrow.
A friend of mine recently did this when he sold his house. I told him it wasn’t kosher but he said that his Realtor and Escrow company and loan officer well all in on it so that they could close the deal. He gave money back to the buyer outside of escrow. But he legally didn’t have to since there was no contract for that.
If the Realty folks do such things for a commission, can you trust them to give you advise that’s in your interest? Buyers beware.