it could also have to do with your health insurance plan. The generic may cost a lot more if you paid completely out of pocket but since that particular generic is on the insurance plan's "list" and the brand name drug isn't, it costs much less.
As a side note, generics can be of considerable less quality and vary in exact dosage from batch to batch due to the more lax laws on monitoring the production process. So, if it is something super important/expensive it is not always in your best interest to get the generic