Sub-Saturns straddle the boundary between gas-rich Jupiters and gas-poor super-Earths/sub-Neptunes. Their large radii (4-8R ⊕ ) suggest that their gas-to-core mass ratios range ∼0.1-1.0. With their envelopes being as massive as their cores, sub-Saturns are just on the verge of runaway gas accretion; they are expected to be significantly less populous than gas giants. Yet, the observed occurrence rates of sub-Saturns and Jupiters are comparable within ∼100 days. We show that in these inner regions of planetary systems, the growth of sub-Saturns/Jupiters is ultimately limited by local and global hydrodynamic flows-runaway accretion terminates and the formation of gas giants is suppressed. We derive a simple analytic formula for the local hydrodynamic accretion rate-an expression that has been previously reported only as an empirical fit to numerical simulations. Evolving simultaneously the background disk gas and the gas accretion onto planetary cores, we find that both the ubiquity of super-Earths/sub-Neptunes and the rarity of gas-rich planets are best explained if an underlying core-mass distribution is peaked at ∼4.3M ⊕ . Within a finite disk lifetime ∼10 Myrs, massive cores ( 10M ⊕ ) can become either gas-poor or gas-rich depending on when they assemble, but smaller cores ( 10M ⊕ ) can only become gas-poor. This wider range of possible outcomes afforded by more massive cores may explain why metal-rich stars harbor a more diverse set of planets.