If siphoning works by gravity then, how does fluid go up then come down? Dumping something out works by gravity. Here is part from Wikipedia:
In practical siphons, atmospheric pressure pushes the liquid up the tube into the region of reduced pressure at the top of the tube in the same way as a barometer, and indeed the maximum height of a siphon is the same as the height of a barometer, because they operate by the same mechanism. The reduced pressure is caused by liquid falling on the exit side.
When both ends of a siphon are at atmospheric pressure, liquid flows from high to low. However, if the lower end is pressurized, liquid can flow from low to high, as in siphon coffee. While in everyday siphons, atmospheric pressure is the driving mechanism, in specialized circumstances other mechanisms can work – in the laboratory, some siphons have been demonstrated to work in a vacuum[1][2][3][4][5] – see vacuum siphons – indicating the tensile strength of the liquid is contributing to the operation of siphons at very low pressures. Most familiar siphons have water as a fluid, though mercury is often used in experiments, and other fluids such as organic liquids or even carbon dioxide can be siphoned.[6]