In my country it's legal to go to Ukraine and fight on the Ukrainian side.
But fighting on the Russian side is illegal and is punishable by long prison terms even if you didn't commit any war crimes there.
That applies to all residents of the country - including Russian citizens.