It’s impossible to login to an Apple account via iTunes if you have cookies blocked in Safari.
So when I want to use my Apple account on iTunes for any reason, I need to open Safari, go to Preferences / Privacy / Block Cookies – Never, then close and reopen iTunes.
Then it works. I guess tying these two apps together has some rationale to some architect, but it’s not very logical for a regular user. I would guess that any iTunes users on Windows never run into this issue.