EU being "a single country of multiple states" is purely a myth.
First, you are refering to Schengen Area, which is a subset of the EU.
Second, and more importantly, several countries, such as France, keep "special cases" for border control within a 20KM buffer zone to the frontier. (and I believe a similar smaller range is applied to any train station receiving non-domestic trains). Look at a map of EU, look at France, and you'll quickly see that, with its central position, France is a basically a big "border control area"...