Does Mail on OS X mark mail as read on the server or just locally?
Mail in OS X El Capitan doesn't have this problem. 

Mark as Read &amp; Mark as Unread affect all of the devices linked to your IMAP account.