Countries are in general immune to lawsuits (sovereign immunity). The federal government has waived that immunity in many cases (e.g. Federal tort claims act) but it's still the overriding rule.
I was alarmed that this concept (sovereign immunity) could even exist. I thought, at first, that only in monarchies this could be a thing.
Sovereign immunity serves important purposes: 1) keeping courts from getting tangled up in political matters; 2) keeping the actions of individual officers from leading to claims against the public treasury.
Note that just because the sovereign is immune (the government itself) does not mean that individual officers of the government cannot be sued. That's why you see all these lawsuits styled Somebody v. Secretary of State.