Right, but sort is apparently clever enough to do a disk-backed mergesort on a file (according to timr's comment), but it doesn't get a chance to recognize that you're sorting a file if you just pipe in the data.
Did you really think sort(1) just bails if you pipe it more data than can be contained in memory?