its got nothing to do with Schengen, it only has things to do with immigration.
Customs is a completely different kettle of fish.
Most country's want to get there hands on you so they get to keep any import duty that they can extort out of you on your entry point.
Flying from MAD to UK will get your passport checked but you go through the EU customs channel not the green or red.