that illusion is cool. the reason that happens is that our retinal ganglion cells have receptive fields that over lap AND are made up of "on" and "off" regions. think of like a target. if light hits the center the of the receptive field the action potential increases, if it hits the side it decreases. so if you think about light can hit the center of the receptive field for one cell, and the side of another. which means one cell will increase in action potential and the other will decrease. this is called lateral inhibition. the perceptual consequences of this center/surround antagonism are that lightness contrast and constancy can appear much different thatn they truly are depending on the ratio of dark/light and the amount of light an object is getting.
lateral inhibition is really cool in my opinion, because without that feature the boarders/edges that we perceive wouldn't be nearly as dramatic