In IMAP, messages marked as read or unread information is stored on the server. When a user marks a message as read, the server is updated with that information so that when the user logs in from another device, they see the message as already read.
IMAP also allows users to set up their own rules for marking messages as read or unread. For example, a user can configure their email client to automatically mark all messages from a particular sender as read when they are opened. This information is also stored on the server and is accessible from any device the user logs in from.