How this connects to AP Physics 1 (Topic 1.4, Reference Frames and Relative Motion): velocities depend on the reference frame. The ball's velocity relative to the ground is its velocity relative to the train plus the train's velocity relative to the ground. The vertical motion is the same in both frames, so the time in the air is the same, but the horizontal motion differs.