The Machines are another intelligent sentient race. They have civilization and individuality (divided). They should be viewed as such. The subjugation of humanity can't purely be for energy as discussed here. So what other possible motives might they have for preserving and controlling humanity?
Civilized peoples do not usually commit genocide. The Machines are even less likely to commit xenocide- the extinction of a species- especially with humanity being their creators. Intelligent beings always ask the question: "Why are we here?" Humanity created them. There can be an aspect of guilt in exterminating your creator. Some machines hate us (as some humans might hate their creator), others like us, and most probably waffle in between. The machines debated on how best to handle humanity (when man seemed hell bent on destroying them) and compromised... meeting somewhere in the middle with a Zoo.
Intelligent beings only look to the stars for the answers if they ignore the ones they already have. The machines HAVE humanity. It's possible some machines treat the Matrix as an experiment and religious experience all in one, studying and interacting with humanity seeking the answer to the question WHY? WHY, Man, did you create Machine? Some will seek the truth and others will resent the situation.
Think about a Zoo for a moment and realize that there can be good and bad reasons for caging animals... then further good and bad ways of treating them once they're inside. The machines needed to preserve themselves as well as humanity and the only way (that they saw at the time) was containment... which Morpheous (rightly so from his position) views as enslavement. It's even possible that some well meaning machines believe that if humanity wasn't in the Matrix they'd wipe themselves out. In a way, like the preservation of an endangered species.
An interesting alternative theory is that the machines use humanity for processing power. While this site does not rule out that use it also does not believe that is sufficient for explaining the Matrix and machine motives. The Animatrix demonstrates that the machine civilization is capable of existing without using the human mind for processing power. So the usage of humans purely for to that end would seem to be too great a liability.