Magic bands are scanned at the entrance to every ride. (Often 1 per group) If the scan does not indicate the guest is staying on-site, then that guest cannot ride.
Nothing prevents off site guests from walking around, shopping or snacking.
Also, offsite guests can enter a queue at 9:59pm for a 10pm EMH. That means lines don't instantly disappear at the beginning of EMH (but they start to flow better with no FP+ riders entering the FP+ queue.)