Yes but it's complicated, and is also different than the doctrine of "standing". Basically, there are whole lot of headache-inducing legal doctrines in play at once when you try to sue some actor in government or government itself.
It sounds like you are referring to "Sovereign Immunity", you cannot sue The United States unless congress authorizes it ("consent to sue"). I may actually have to dig up my old "federal courts/federalism/separation of powers" casebook. In short, the answer is "it depends" as it just about always the case in law. I hesitate to say much because I haven't had to know any of this stuff for quite some time and it is a pretty complex subject.
This is an example of consent to sue, aka, waiver of sovereign immunity:
https://en.wikipedia.org/wiki/Federal_Tort_Claims_Act
I suppose that doesn't explain very much either, though.
The two biggest questions are: (1) whom or what exactly are you suing, and (2) what are you suing for? Different rules would apply to suing an on-duty police officer for something he did to you (in his official capacity), suing the municipality that employed him, suing him for something he did to you off-duty at a bar, suing a government agency for taking a particular action, or suing a government agency for how it went about in making a new rule, a federal contractor suing the federal government for damages, and whatever other number of imaginable situations there are.
There are some absolutes. You definitely cannot sue the legislature for passing a law, for example. But you could certainly challenge a law that is being enforced against you in whatever case it is being enforced in, but then that isn't the same as "suing the government".
I'm fairly certain that sovereign immunity does not cover individual actors in government in all cases. For example, if a police officer who beats you to a pulp during a traffic stop without provocation and you want damages. However, you'll be up against other forms of immunity (qualified immunity vs. absolute immunity). I do recall that it's quite a lot easier to sue the officer as an individual in that instance than it is to sue the municipality that employed him. You'd typically want to do the latter if you could because it has bigger pockets, but I vaguely recall some sort of doctrine that requires you to demonstrate that the municipality knew its PD's training was so very bad that what happened to you met some high degree of predictability.
However, it may be that I'm wrong and in fact, every state has some kind of limited waiver of sovereign immunity that allows the bad police officer to be sued in his official capacity.
Ended up typing more than I intended, heh...