The apparatus is not connected at the red line in this image. The part to the left (the wheel) is on the ground and farther away, the part to the right (the start of the track) is in the air and closer. They just happen to line up due to forced perspective.
The water just seeps down into a hidden reservoir in the left part, and is pumped up at the appropriate time from another reservoir in the right part.
Edit: see below, it looks like the discontinuity is at a different point.