Being considered a cost and providing a competitive advantage are not mutually exclusive. An IT department that meets its goals at a lower cost than an alternative could be a competitive advantage.
An example of an IT department that's a revenue-generator is Amazon's, in the sense that they sell services outside of the company. But that's quite rare. At most, some IT departments chargeback internally, but that's just made-up money.
Then again, I think it was Bezos himself who described Amazon as a technology company that happened to sell books too.