Petra was largely created in the first to third centuries b.c. by the Nabateans, an Arabic tribe who grew rich from trading with (and extracting protection money from) the great caravans which passed this way.
The Nabateans made all of their money from farming.