The grey squares are identical.
Simultaneous Contrast
Compare the two inner grey squares. The one on the left looks lighter, right? Click 'Separate' to prove they are identical.
Lateral Inhibition
π Retinal WiringβΌ
This effect starts in the retina itself. When a neuron is excited by bright light (the white background), it inhibits its neighbors. This makes the grey square in the center appear darker than it really is.
Conversely, the black background does not inhibit its neighbors, allowing the grey square to surely appear relatively brighter. It is a biological edge-enhancement mechanism.