Allegedly the major governments participate in a cooperative spying exchange dubbed Five Eyes. Since it's illegal for Country A to spy on their own citizens, they instead have Country B do it and vice-versa. Then participants exchange info in a quid-pro-quo fashion.