I think I see a dual triangular join between Deleted and Inserted and that might give you a funky rowcount... but I don't see anything in that code that would even come close to insert rows...
What makes you thing the rows in TableB where duplicated? Did you do a before and after dupe check or are you just looking at row counts?
--Jeff Moden
Change is inevitable... Change for the better is not.