No functional change (intended).
This code dates back to 4.4BSD, became wrong after some getgrouplist()
(nssswitch-related) change in 2007, was fixed only in 2020 and since
then underwent cosmetic changes.
It is likely that in fact it never served any useful purpose in FreeBSD,
except perhaps at the very beginning. It's certainly not the case
today: NFS credentials are only used to check for file accesses, whose
group is checked against all groups of a credentials indiscriminately
(except for the real GID). Consequently, having a single duplicate,
which the code would actually remove only if in the first supplementary
group slot, doesn't change behavior. Moreover, saving up one slot is
not a concern either as NGROUPS_MAX (1023) supplementary groups can be
passed (and see also next commit, regaining one slot). And if it ever
becomes one, the proper change is to have mountd(8) use
sysconf(_SC_NGROUPS_MAX) (and the administrator should raise the value
of the 'kern.ngroups' tunable).