In the cyber-wars of today, all sorts of things occur of dubious legality, or outright illegality each and every day, of which some of these things are done by hackers, clearly working on their own agenda, whether for a so-called greater good, or for exposure of corruption of all sorts, or whatever, and the other big player, being governments of all sorts and for all sorts of reasons that have certain agendas that they like to see get accomplished. In some governments, hackers are actively recruited to serve government interests, specifically to obtain or to compromise information from dissident groups within their country, or to infiltrate targeted countries, in which, these hackers are basically deployed as state-sanctioned agents with immunity for things that would most definitely be considered crimes, if they were, in fact, acting outside of such state-sanctioned protection. So too, in the United States, hackers of great renown, or skill-sets, are actively recruited to work on behalf of the government, in plying their trade, in which, sometimes the recruitment is basically straight-up, that is to say, a lucrative offer is made to individuals that have demonstrated both skill and initiative, and sometimes a deal is made in which because a particular hacker has violated some law, they are essentially co-opted by a government agency to work for them, in return for charges being dismissed, reduced, or dropped.
There are several basic contradictions in the world of hacking and how it is treated in which, quite basically, hacking that is done on behalf of governmental agencies, which have received overt or covert permission by the authorities so regulating them so as to spy, to interdict, to disrupt, or whatever, are all activities that unless some sort of egregious behavior which has been embarrassingly exposed occurs, pretty much anything goes. This essentially means, that things that hackers do that would clearly be crimes if they were acting on their own or with some other agency not sponsored directly or indirectly by government forces, are not crimes. It then follows that to hack into a foreign government's computer system in order to obtain documents or information, if done on an individual basis, is a serious crime, whereas, to do so as sanctioned by your own government, is often well compensated, and the people doing such, pretty much have immunity from the prosecutorial arm of the state, if not outright eligibility for rewards on particular jobs done expertly.
So if a particular hacker only has the best interests in mind, such as to release information that shines a light on governmental or industry practices, that are of questionable value, or clearly inimical to Constitutional law, to do so, is often considered to be a crime; whereas those special ones that are actually committing overt acts that endanger this country, or interfere with other countries or other people or other industries, are pretty much immune to any trouble, especially if position papers have been created, somehow justifying this sort of activity, or a quid pro quo has been initiated, in which, the justice department's arm has been stayed, everything remains okay.
A world in which, on the one hand, certain actions that you as an individual take are subject to the penalty of the full weight of the law, whereas, the same actions or even worse, when state-sponsored, are not, signifies that this isn't a country of the people, by the people, but a country instead that serves faithfully those in positions of authority, and those that try to infringe upon this, suffer for their audacity or ignorance.