Obviously you have to research terrace farming
http://en.wikipedia.org/wiki/Incan_agriculture
Seriously, I have seen instances of huts, etc. on top of a mountain. The fertile land is supposed to be on flat land, so that sounds like a bug. Could you provide a screenshot?