If two embedded surfaces are tangent along a curve, their tangent planes agree there. The curve's ambient acceleration is normal to one surface exactly when it is normal to the other, so it is a geodesic of one exactly when it is a geodesic of the other.
Codex Wiki