“Journalist” isn’t clearly defined, but they do have some special privileges in many countries.
https://en.wikipedia.org/wiki/Journalism#Legal_status:
”Journalists in many nations have some privileges that members of the general public do not, including better access to public events, crime scenes and press conferences, and to extended interviews with public officials, celebrities and others in the public eye.”
https://en.wikipedia.org/wiki/Reporter%27s_privilege:
”Reporter's privilege in the United States (also journalist's privilege, newsman's privilege, or press privilege), is a "reporter's protection under constitutional or statutory law, from being compelled to testify about confidential information or sources."”
Also, in some (¿many, I would think, but I don’t know stats?) countries the justice system will weigh the right of the public to know against law infractions when deciding whether to prosecute journalists who performed crimes in order to gather information.
For an example, see the pentagon papers (https://en.wikipedia.org/wiki/Pentagon_Papers). All concerned knew the information was top-secret and stolen, but in the end, nobody got convicted for publishing them.