Last modified: 2014-11-18 18:07:27 UTC
Foreign files use a HTTP request with action=render, which results in absolute links. Local files call the parser, which gives relative links.
Apparently, the decision whether to use relative URLs is made somewhere deep down in the bowels of the parser by checking the value of $wgRequest->getVal('action'). Fun.