I see YouTube pilots do it all the time, but I’m wondering how safe this maneuver really is given the fuel is a gravity fed system. Also, is it legal?
When doing "bunts", it's about the oil, not the fuel. The airframe doesn't care; it's in a ballistic arc and is completely unloaded, like some trash you launched into a neighbor's yard with your Yard-A-Pult.
Overall, the main risk is of a temporary drop in engine oil pressure when oil in the sump turns to globs and floats around, potentially unporting the oil pump suction pickup at the bottom of the sump.
The effects of this are less severe in a carbureted engine because the engine will also quit temporarily while this is happening (the carb will flood), and without the torque related forces acting on the main bearings, it's unlikely to do damage to the main bearings for the couple of seconds you can sustain the bunt.
Oil pressure loss is more likely to happen if you push too hard and go negative G. All the garbage that was on the floor, and is now on the ceiling of the cabin, also tells you that the oil in the engine is up against the top of the sump and running backwards through the drain path into the main crankcase, and the oil pickup is sucking air for sure.
If the engine is fuel injected, the risk of doing real bearing damage is higher; it'll still produce power during the time you can sustain the maneuver (until fuel in the lines is consumed if the fuel in the tanks unports, which will take longer than you can sustain the bunt) and if the oil pressure drops while it's making power, that's a very bad thing, as it's likely the main bearings will achieve metal to metal contact, and it's downhill from there.
If I was an FBO who learned that my renters were doing zero G bunts in my planes, I'd probably be not too happy about it.