In 1 Corinthians 12:28, it is written that "...God has appointed these in the church: first apostles, second prophets, third teachers, after that miracles, then gifts of healings, helps, administrations, varieties of tongues." Just like other spiritual gifts, the gift of teaching is given by God, and it cannot be bought or earned.