Money flows towards the writer.
That’s all. All writers should remember it.
When a commercial publisher contracts a book, it will pay an advance against royalties to the writer. Money flows towards the writer.
Literary agents make their living by charging a commission of between 10 and 20% on the sales that they make on behalf of their clients, the writers. When advances and royalties are paid by a publisher the agent's percentage is filtered off in the direction of the writer’s agent but the bulk of the money still flows towards the writer.
If a publisher ever asks for any sort of financial contribution from a writer, they're trying to divert money away from the writer, in direct contravention of Yog's Law.
If an agent ever asks for up-front fees, regardless of what they call them (reading fees, administration costs, processing fees, or retainers), then they are trying to divert money away from the writer, in direct contravention of Yog's Law.
It’s a brilliantly simple rule. We should thank James D Macdonald for it in the best way there is. Buy his books.