Cosmic rays up to at least PeV energies are usually described in the framework of an elementary scenario that involves acceleration by objects that are located in the disk of the Milky Way, such as supernova remnants or massive star-forming regions, and then diffusive propagation throughout the Galaxy. Details of the propagation process are so far inferred mainly from the composition of cosmic rays measured near the Earth and then extrapolated to the whole Galaxy. The details of the propagation in the Galactic halo and the escape into the intergalactic medium remain uncertain. The densities of cosmic rays in specific locations can be traced via the gamma rays they produce in inelastic collisions with clouds of interstellar gas. Therefore, we analyze 73 months of Fermi-LAT data from 300 MeV to 10 GeV in the direction of several high- and intermediate-velocity clouds that are located in the halo of the Milky Way. These clouds are supposed to be free of internal sources of cosmic rays and hence any gamma-ray emission from them samples the large-scale distribution of Galactic cosmic rays. We evaluate for the first time the gamma-ray emissivity per hydrogen atom up to ~7 kpc above the Galactic disk. The emissivity is found to decrease with distance from the disk, which provides direct evidence that cosmic rays at the relevant energies originate therein. Furthermore, the emissivity of one of the targets, the upper intermediate-velocity Arch, hints at a 50% decline of the cosmic-ray intensity within 2 kpc from the disk.