The short answer, as far as the USA, is that money exchanged to share expenses, such as food, fuel or mooring is not considered payment. So, no license or inspection required.
Payment for passage requires USCG license and inspection.
I believe this precedent has been set in US courts. However, I never accept money from friends or acquaintances. I will accept beer and food
Someone please correct me if I'm wrong.