The brain explanation part of my reply-
The brain part of this is simple - it's pure muscle memory. Muscle memory is processed in the cerebellum, and coordinates all the fine, precise movements at a level your conciouse brain can't. The only thing you conciously have to do, is start the movement, and your cerebellum does the rest (it's the same thing with walking, you aren't thinking about what muscles you're using to hold your balance, you just do it).
To the person who was amazed they played a piece flawlessly the next morning after struggling with it the day before - Your brain is unbelievably fast at developing a memory of movements; but most of those connections are made while you sleep. You may be struggling with a section that day, but you've repeated the movements enough that your brain just needs time to process. If you find you can't get something right, no matter how many times you've practiced it that day, it's because your cerebellum needs to connect up all of that information. There's only so much you can do in one sit down.
My personal part of my own reply

-
What my question is... if you rely on this almost entirely for playing, is it a bad thing? I've been playing the piano since I was 2 by ear, and only really been getting deep into music theory the past year (I'm 25).
I only need to read the sheet music once (granted I go measure by measure) before having the notes down regardless of how complicated the measure is. I play slowly, making sure I have good fingering, I glance ahead to make sure my fingering gets me to the next measure, and then I build up speed. Once I can play that measure at speed comfortably (and at this point I'm relying on muscle memory), I generally begin working a bit on the musicality (though I don't tackle this aspect entirely until I know the entire piece).
For heavy chord passages, I typically remember the shapes my hands make to hit the chord, and I trust my muscle memory to a point that I rarely make a mistake in passages I'm comfortable playing. But I can't tell you what notes I play readily in any given song as that's all intuitive for me. I can tell you how many notes I hit, and their relation to each other, but not the notes, and sometimes not even the key (if it's been a while since I've played it).
It's interesting, because if I go back to a piece I haven't played in months, I usually will start in the wrong key, hit the notes exactly as I would if they were in the right key (which obviously sounds terrible), and have to hum the correct starting note outloud until I find it on the keys. Once I hit that first note, I can play the entire piece exactly as I would have a few months prior.
So my question then is... is this a bad thing? A bad way to practice? Making music theory intuitive after 23 years of playing by ear is a really tough thing....