The gain profile of a quantum cascade laser is strongly influenced by the lifetime of the carriers in the upper and lower laser state. The quantitative description of gain within the concept of nonequilibrium Green's functions allows for a detailed understanding of various features affecting the gain spectrum: Compensation effects between scattering processes in the upper and lower laser level, reduction of gain due to coherences between nearly degenerate upper laser states, and dispersive gain without inversion.