This has been debated since sellbot factory first opened.
In buildings, it is indeed the first cog (which will stand on the right) and the last cogs standing. Ocassionally, it will also be the second from the left, usually when there are 4 cogs to begin with.
In the factory, the rightmost cog will get lure bonus, and in sets of 3 sometimes the left will, sometimes it wont. In the warehouse and center silo, where there are sets of 4, the second from the left WILL, as will the right, but not the other two... EXCEPT, that if you take them out one at a time, the last cog WILL no matter where he was standing.
As for the mint and DA, it appears to me to matter which cog you "touch" which ones actually get bonus.
The right always will.
(THIS IS WHY PEOPLE SHOULD NOT TRAP THE RIGHT HAND COG!)
sometimes the second from the left will, sometimes the far left will.
The last cog standing, if alone, will.
Here is one of the threads where we talked about this
Strategy alternative to 1fog/3ele
The factory one is much older, you would have to look in the 2004 time range.
Hope that helps!