It sounds to me like you have unusually advanced skills for a TA, and the professor is quite rationally trying to allocate the resource he has control over (your time as a TA) to its maximally productive use. That sounds pretty reasonable from the professor's point of view. Whether he has a right to assign you this particular sort of work would depend on your institution and department. At my department, TAs sign a contract at the beginning of the quarter which includes a list of the types of work they will be expected to do. If the professor wants to add something that isn't on the standard list, that needs to be discussed prior to that stage. The contract also specifies the number of weekly hours the TA will be working, and obviously the professor needs to respect that limitation as well.
Now let's think of how things look from your point of view. I'm not exactly sure why you feel taken advantage of for being asked to work on the software project, except for details that sound irrelevant to me, such as:
that the professor has previously paid someone for a similar service (maybe he did not have access to a TA with such qualifications as you);
that you would have gotten a higher salary for doing similar work in industry (but you willingly chose to go into a graduate program and subsist on a grad student stipend for a few years);
that you are not paid directly for being a TA but through some kind of indirect funding arrangement (but you are still committed to doing work as a TA for X hours per week, so I don't see why that should matter).
If I make the reasonable assumption that the high-value software development work is more intellectually stimulating than other duties the professor can be assigning you as a TA (grading papers or other boring gruntwork), are you not yourself better off working on the software project? In that case, could it be that the feeling of being exploited is simply regret for choosing this particular academic path when you could have stayed in industry?
To summarize, my feeling is that unless the work the professor is assigning you is completely outside the scope of work that a TA in your department could be reasonably expected to help with (which may be the case if you are, say, in a humanities program), you are probably not being taken advantage of. But perhaps I misunderstood the situation or your reasoning for being concerned; if you care to clarify any of the details I will reconsider my position.
Edit: I'm sorry if the OP finds my answer a bit tone deaf. I'm generally quite sensitive to and concerned by the phenomenon of exploitation of graduate students in academia, as can be seen by perusing my SE history. I think it makes sense to revise my verdict slightly: Jack, you are not being taken advantage of any more than TAs are typically taken advantage of. That is, I don't find anything unusually exploitative about the software development being discussed here, but the whole system of employing graduate students in academia as cheap labor (whether it's calling them TA's, RA's or something else) does carry with it an unpleasant whiff of exploitation. This is well known and recognized by many people (and has provided fodder for many a web comic). So you are right to be at least a little concerned about that -- how much exactly depends on your school. But I think that is off-topic given your specific question. Bottom line is, be aware of your rights, and if your contract says you should only work X hours per week, insist on following that to the letter.