In aniline the lone pair of nitrogen atom is an conjugation with the π-electrons of the benzene ring and thus, takes part in resonance. Hence, this pair not available for donatination while in ammonia it is so. Thus, aniline is less basic than ammonia.