Observation of oscillatory energy exchange in a coupled-atom—cavity system