The sequence is the following one:as yovanna states
gross production >> -army upkeep >> -loan payment >> -alliance tax
seems to me this also is part of the problem for alliance treasury's as anyone taking alone hurt his alliances income in gold production big time. as treasury was still getting a full x% share from wood iron and stone production gold is only getting a portion of the set tax%. so alliance treasury's while receiving the full set tax % on the 3 commodities with gold treasury would only receive a increasingly smaller percentage of your tax% going to treasury as u grow and have larger army's upkeep and loan payments those 2 really stifle the growth of alliance funds. and basically punish an alliance for large armies and loan taking. and lets get for real we all know u pay the tax man first