Anytime I recruit a unit better than a levy or settler they die of attrition in my territory. The city they are sitting in produces more than enough to pay their maintenance but they wont take it for some reason.
A City Builder / RTS · By
I've noticed that only my levies reliably got maintenance; as a result, I decided on having standing armies of levies and, when needed, mass-recruiting stronger armies. They'd fill their purpose (defeating ghuls or crushing enemy armies) before they died to attrition, and times of peace generally last long enough for more recruitable units to appear.
UPDATE: It looks as if building a warehouse lets spearmen get the gold they need (if they camp on the city and, of course, I have enough goods); presumably that'd work for other units as well.