Yes, it can be hereditary. The main reason are the hormones,
male sex hormones (androgens). Your case looks like hair loss which
the men suffer becasue of hormones. It can start in such young age.
There is no cheap way to prevent it. There are pills - Propecia,
but they cost something and causes
loss of sexual desire. See the Hair Issues thread, it deals with
such problem.
Propecia, nice mane and no sex, or bald but potent.