I think that the AIs will sell technology for gold per turn from other AIs. But sometimes due to loss of cities or maybe an anarchy period, or I guess switching to Fascism, the AI no longer has the same economic capacity. Do the AIs change their tax rate to pay off their debt? I suspect that they do, but sometimes they lose a city or population and don't have any gold in their bank. But, they still end up paying the gold per turn that they promised that they would pay to another AI (or the human player), implying that the gold gets created out of nowhere.