Why can golf and country clubs be nonprofit

Why can golf and country clubs be nonprofit organizations, but not charities?