I think it basically boils down to setting a different subject in the #webfinger reply, e.g.
https://mas.to/.well-known/webfinger?resource=acct:helgek@mas.to
if I moved to borg@social the subject would be
"acct:helge@borg.social".
https://docs.joinmastodon.org/spec/webfinger/ links to the two relevant RFCs.