Domain Mapping -- what happens to backlinks ?

I was wondering how redirects are handled, in particular for backlinks, when using Domain Mapping --

say you have a subdomain subsite
and you build content and links to it
then rent it out to a domain and it turns into

then later... the domain map is removed and it goes back to

are the links to pages 301 or 302 redirects - or is wordpress doing something else? and if it is something else do we lose those backlinks/SEO juice?

wondering about social shares too, but I think that is a different thing going on