I think what you are asking for are server side email filters.
The most common implementation is Sieve, which is supported by Dovecot, Cyrus, and Stalwart IMAP servers (and probably others I’m not aware of). There are a variety of clients that support it, including Thunderbird and Roundcube.
This is how NFS works. Making sure that usernames and userids match on all of your servers will fix this and is by far the simplest solution. If it didn’t work, you probably just made a typo somewhere.
Other options.
Use an LDAP serer (I like LLDAP) to provide a single user database for all your servers. This has lots of advantages (can provision users and change passwords for all servers in a single place). But it is fixing your problem in the same way as above (making usernames and user ids match on all of your servers).
Use Samba/CIFS instead of NFS. Because you authenticate with a user/pass all actions happen as the user you authenticate and so local user permissions don’t matter.