Basicity of aniline gets decreased due to the resonance of the benzene ring. This resonance decreases the electron density on N atom and thus it is now not available for donation. This resonance is not present on methanamine. In fact the electron releasing effect of methyl group increases the electron density around N atom which increases its basic character.