The problem is often that, even if you NEVER declare war, someone will DOW you at one time or another, and if you defend yourself and take cities, the penalty will be exactly the same. This is stupid IMHO... if someone DOWs me and I beat the crap out of him/her, well so be it, you got what you deserved !!!
But those penalties are visible - you can check your diplomatic relations and see something like "-236 Your warmongering". What Disgustipated et al. are talking about are situations where the diplomatic screen suggests that some AI likes you a lot (like +30 overall) but won't declare friendship. A few turns later it looks exactly the same (from what is visible) but suddenly they are willing to be friends.
Two possible explanations are:
* There are invisible modifiers like "-20 Even though officially there is no warmonger penalty for this type of war we still don't like anyone who is at war with anyone".
* There are more factors determining the AI's willingness to declare friendship than your diplomatic relation. Something like: They are your neighbor and consider war but if they really declare will depend on if they find a joint war partner and / or if your military score stagnates. If those conditions are met, they betray you and declare war. If not, they are open to friendship once again. I have no idea if something like this does happen because what we know about the AI programming isn't too promising. But I would certainly like it if considerations like these are behind there seemingly random mood flips. In any case I'd rather pretend that's the case than hidden modifiers. It makes for better stories .