@wolf@mastodon.social Oh, right. I was half-right. The s and H options were what I was looking for, not i. The sudo -i option uses the shell configred in /etc/passwd. The -s option uses your current shell (essentially) and the -H option tells the new shell to ise whatever home dir is configured in /etc/passwd.
Make sure your mastodon user has something like /home/mastodon in their /etc/passwd entry. Then use:
sudo -u mastodon -sH
("sudo -sHu mastodon" probably also works.)