MDMA molecules, like those of other drugs, are fat-soluble. They can therefore easily penetrate the walls of the capillaries that form the blood-brain barrier, even though these are better protected against external substances than other blood vessels in the body.
The MDMA molecules can move freely between the neurons (brain cells), where they produce their psychoactive effects.