They know that nobody standing in front of a customs officer that is looking at their photo will actually be smiling. So having it neutral or even scowling as your experience will be much more likely to match. /s
Some countries (definitely France) are implementing automatic passport photo checks. Those checks are not at all rigorous concerning smiles. I managed to get a photo I'm actually proud of in my new ID!
https://www.passports.gov.au/PhotoGuidelines