Back story: I started working for a well-known company (WK Company) through Temp Agency A. Several months later, WK Company decided to consolidate everyone to the same temp agency, so I started work for them, but through Temp Agency B. Several months after that, I was hired on as a full-time employee by the WK Company. All these were technically the same position. How would I list this on my resume?
Been there, done that. On the resume focus on the title and description of the position and what you did, not who's name was on the paycheck.
Example: "Software Engineer at WK Company, 9 months (5 months contractor, 4 months full-time)". You can detail what you did, but don't even mention the Agency A/Agency B issue on the resume - it doesn't matter, other than to the tax agency.
The people who look at your resume in the future care what you did, how well and who might be a reference for you, not who's name was on the paycheck or tax form. If they care enough to interview you or ask about this, then you can go into detail. But a future hiring offer isn't going to revolve around how the temp agency was structured. It would only matter if they are trying to get references or there is a conflict of interest.
At the future interview time you should point out that you were a contractor, and they liked your work enough to keep you around through two temp agency re-orgs and then made you full time. That alone is prima facie evidence they liked you.