First off, I assume that in your second case, you meant to take the median along dimension 2. Otherwise, you don't get equivalent results.
I think you will still get very different timing results, based on a quick peek inside the median function, using
>> edit median
I frankly did not dig deeply to get an understanding, but there is very clearly code (lines 93-101) that takes advantage of vectorization for 2-dimensional arrays.