why does it happen that another faction always gets more gold from our trade treaty?
You and it both get a 10% bonus to your cash income. If it gets more, it's because it had more to begin with. I also usually get less than the AI on trade, but I usually get two or three times more than them on technology treaties.
And of course, once you have beaten an AI down to a smidgeon of what they used to be, you can usually force them into peace. It may cost more than surrender (which is ridiculous in itself) but then you can get them into a trade/tech/alliance treaty, and get a 10% bonus on both. By the time they are this weak, everyone has declared was on them, so they will be your best friend forever. Just make sure you keep them alive.
It's fun winning an alliance victory with all AIs still alive, but most down to one city. You get fewer diplomatic penalties this way, too. Fewer, not none.