A program is a tangible, physical arrangement of electrons
One could likewise argue that math is a tangible physical arrangement of pencil marks on a page or of neurons in the brain. But the point remains that math is not patentable.
Should someone be able to patent a prime number? Discovering a new large prime number requires effort, skill, lots of compute cycles, etc., but it's not patentable. Discovering an algorithm that has novel properties also requires effort and skill, but it shouldn't be patentable either, because it's math.
All possible medicines are implied by the rules of chemistry
Maybe eventually we'll understand the rules of chemistry and human biology as well as we understand the rules of math, but until that happens the case of medicine is not really comparable to the case of software.