iMessage to Mac when logged off
In my experience, iMessage syncing is not reliable but it does work most of the time. As a result, it's difficult to ascertain a definitive answer. The intended behavior is as you described it and there should be no gap in Mac message history. 

However, for me, it doesn't sync 100% of messages all of the time. It does sync most of the time. The other thing that can happen is a time delay. For example, I booted up my Mac after an extended period of having it off and no messages came in. The next day when I booted it up, everything came in.

If most of your messages are not syncing, I suggest disabling iMessage on your iMac and iPhone and then re-enabling it both places.