Hi CookieBe,
The email folders you're referring to are indeed on your Mac only, not included within the emails still with the email account.
One thing you can do, is to look through Time Machine to see if those emails are found, and then you can move them over. Check out these steps:
Restore items backed up with Time Machine on Mac - Apple Support
If that doesn't work, it may be because On My Mac is local only per: Create or delete mailboxes in Mail on Mac - Apple Support
- "On My Mac: Mailboxes you create in On My Mac are local, meaning you can access them only on the Mac where you created them."
You might try exporting them, then manually moving them over manually with an external drive or thumb drive, and importing them on the new computer, but again, it may or may not work as this mailbox is local only: Import or export mailboxes in Mail on Mac - Apple Support
Take care!