"Come at a cost" (or "come at a price") is an idiom. I don't hear it much in the USA so I believe it is more common in the United Kingdom. "Come with a cost" is not an idiom and should probably not be used. Even though "come with" is a very common phrase, and "come at" is not seen in many sentences, the idiom uses "at a price". The important thing to understand about idioms is that they are simply common expressions, and they are said how they are said, even if the word order or word choices don't seem to make sense. I hope this helps.