This problem may be alleviated if teachers negotiated as a group. Programmers and systems analysts often get employed through contracting organisations but teachers are rarely employed this way. It is easy enough for you to work out the rough economics of giving a course. I know that some courses subsidise other courses but don't let that fool you. If there is too much subsidisation going on then the institution is not organising its programs efficiently.
Administrators spend far too much on administration and other overheads.
If you produce course material used by others then you should charge for it. If you produce course material but do not get paid extra for it then it is yours and the institution should not reuse it without your permission. The price you charge for the course materials needs to be based on the time it takes you to prepare it and the amount of income you are likely to receive from its use. Sometimes it is the price you have to pay for repeated course delivery income. Perhaps you can supplement your income by trying to sell materials you produce to others.