The programmer only uses the SPI pins when the ATmega is in reset (Reset pin held low). While held in Reset your program does not run and all pins are set to inputs. The programmer sets its outputs to inputs before releasing the Reset line so it won't be fighting the ATmega outputs.