Pirate flags

Growing up on the water in Alaska, I heard a number of captains say that “any vessel flying a jolly Roger is denouncing it’s national ties and can be legally boarded and taken.” They would always bring it up as humorous trivia, but swore it was true. Could there be a hint of truth to this? My fellow crew and I tried to look this up, but could never find anything and have written it off as baloney.

Anyone have any input? Could this be stemming from a very old anti-privateer/pirate law?