It’s because when placed inside the engine bay, the large wiring harness is shorter, which is not only cheaper, but also shorter wiring helps with the consistency of electrical timing and reduces noise.