Zinc is more electro-positive than iron. Therefore, as long as zinc is there on the iron pipe, zinc acts as anode and the iron as cathode. As a result, rusting of iron is prevented.
On the other hand, tin is less electro-positive than iron. Therefore, when tin coating over iron gets broken, iron acts as anode and gets oxidised. Thus even when tin is there, the exposed iron gets rusted.