at a cost
idiomDefinition of at a cost
: by giving up something else
He had achieved fame, but at a cost; he'd lost many friends and no longer talked to anyone in his family.