To wildly summarize...for the same reason you are not CONSTANTLY sick. your stomach is a pretty good, but not perfect, immunodefense - i.e., the stomach is a pretty tough environment for survival.
whether it is worth the trouble also depends on the method of infection. The live attenuated oral polio vaccine creates gut immunity, which is helpful because polio is passed via ingestion of infected materials. Gut immunity is less useful if a disease is passed via inhalation.