I doubt the US would prosecute you though for hacking Russia.
But Russia can be an ally against certain enemies like isis because interests align. Similiar to China.
Ukraine is a democracy ally which puts them on another level and talks about them joining nato also put them on a different level.
The Ukrainian American veterans flying to Poland to defend Ukraine right now are also breaking US law, but there will not be any legal consequences for their courage and bravery.
For another country to go after US citizens, the country has to first file paperwork in US federal court, and then, have a judge care enough to proceed.
What drugs are you on to think Russia has any standing in US court regarding _anything_ that happens in Ukraine?