If these mailboxes appear under "On My Mac", that is perfectly normal. They are not attached to the mail accounts, but are stored inside your account in your mac.
You have to export the mailboxes from the old account, and then import in the new one.
The process is not difficult:
So let's say you are in account "A" and want the mailboxes to be accessible in account "B"
1) In the account "A", open Mail and select all the mailboxes that you want to export.
2) Control-click and choose Export Mailboxes...
IMPORTANT: you need to export to a place that your account "B" can access.
My advice is to put them in the "Public/Drop Box" folder for that account.
So when choosing the destination, press command-shift-H to go to the home folder; then press command-up arrow to move up to the Users folder; now navigate down to folder "B", then Public, then "Drop Box" and click "Choose".
3) Open Mail in account "B" and choose File->Import Mailboxes. Choose "Files in mbox format", then navigate to the folder where you exported in the previous step and select all the .mbox files. Give it a little time and all should be there inside "Imported".