There is no easy explanation for this.
You need to strip out the cell padding and cell spacing in your tables.
Then insert a spacer TD using smarty to only insert the space between the first and second and second and third but not after the third TDs. This assumes you use a 3 column layout.
so...
Code:
{if !$smarty.foreach.foo.iteration % 3 = 0}<td> </td>
then placed borders on the left side of the TDs that hold the product info.
now use a variation of above code to place a border on the right of only the last TD in the product foreach array.
Now just place a new set of TD in the product array to hold the top and bottom borders.
Hope this kinda helps, may have left out a step or two. I'm exhausted so I may revisit this in the AM.