When you capture a city, you are offered the "Keep or Raze" option. If you try to make peace before selecting the "Keep" option, the city you just captured remains in limbo -- the peace treaty screen doesn't know what to do with that city, so it does not present that city as an option for cede or return. And if you complete the peace treaty and then select "Keep," it appears the city will retain the "Occupied" malus.