Core internally returns (query return) the MTP of block N+1 when asked for block N. We never inherited this internal slop, but they actually also emit it on the wire via their json-rpc interface. So when you get the "median time past" with block N, you are actually getting the MTP for block N+1. Something to watch out for when validating the interface.
(edited)