However, in my experience it's haphazardly enforced. If you're on good terms with a colleague or manager, it's my understanding (IANAL) that they can still provide an informal or personal reference. In practice, for most prospective employers this is just as good as a formal reference (since most companies these days have the aforementioned policy anyways).
I guess it's just another sign of corporate hypocrisy - please provide references when applying, but we will not allow you a reference when leaving.
In my experience, although near-ubiquitous a no-reference policy mostly seems to mean "if anyone calls the company line or shows up on prem, we redirect them to HR who then tells them nothing". It doesn't mean they go out of their way to stop individual employees from giving positive references on their own time (to wit I've never seen any employer actually make any effort whatsoever to disseminate their no-reference policy to employees, it's just a CYA measure they adopt if communication happens through channels they're directly accountable for)