Suppose that website A inserts a link to website B. But it doesn't do it directly. It uses an internal link that redirect to website B. Considering SEO, does this link benefit website B? And what kind of redirect (301, 302 or 303) affects this behavior?
Yes, it's benefits to target website, there are already bunch of website using like that.
If you insert above link on your website(
www.mywebsite.com) and it's redirect to
www.someothersite.com then Google will also follow(unless it's not blocked under robots.txt) that redirection just like our browser do, because they use similar kind of webkit to render such a webpages.
Now affliate websites also do that, for example,
www.example.com/recommended/some-affliate-webpage/ but they block that recommended directory on their website via robots.txt, so the pagerank will not transfer to that affliate webpage. I don't know why you're asking this question, but if you have some kind of website like that and you don't want to transfer pagerank(Because of link spam) without using nofollow attribution then robots.txt is also better option.
There is also another example of webmasterworld forum. If you check that website then you will know they're not using nofollow attribution, but whenever any user insert the link it converts into internal links and then do redirection, like this
https://www.webmasterworld.com/r.cgi?f=30&d=4843612&url=https://www.seroundtable.com/google-search-console-link-no-data-available-23677.html But their cgi directory is blocked under robots.txt so the Pagerank and other link matrics value will not going passed on