Apple’s Mail and most email clients on every platform and from every third party optimize their defaults settings around leaving mail on a server. That’s the modern way, where we can reach the same mail storage on any device, as well as through web mail.
However, it’s possible to avoid all this. You just have to change a view settings and rethink how you file mail once you’ve dealt with it. You can archive messages on a single Mac and store them there without leaving a copy on the server but you’d better be making backups, Time Machine or otherwise, or you’ll be sunk if your drive fails.
Your Inbox will always remain on the server. The Inbox is essentially a window into messages that have arrived and you haven’t processed. You make one change in settings and one change in behavior for everything else.
In Mail in macOS, follow these steps:
• Select Mail > Preferences and click Accounts.
• Select iCloud in the list at left.
• In the Account Information tab, set Download Attachments to All (the only reason to avoid this if you get frequent large attachments in messages you delete without needing those attachments).
• In the Mailbox Behaviors tab, for each mailbox popup menu, select a mailbox listed under On My Mac (if no mailbox exists, you need to create it from the Mailboxes sidebar).
Now all the standard Mail behavior will result in messages being downloaded or stored on your Mac.
On the behavior side, create all the mailboxes you need under the On My Mac section of the Mailboxes list, and then as you receive email in your Inbox, file those locally into those folders. That removes the messages from the mail server, leaving it stored only on your Mac.