The AI purposely loses by declaring war and then offers one of their cities 10 turns later in exchange for peace. Please help.

Had to quit my game after 100 turns because the AI declares war on me and then 10 turns later offers me a peace treaty AND OFFERS ONE OF THEIR BEST TOWNS/CITIES. Every AI on my continent, multiple times. All the other AI's on my continent have only 3 cities/towns now. They just keep giving them to me in exchange for peace treaties, even if I wasn't attacking them. I was playing on Viceroy difficulty, whatever that means. Someone please make this make sense.