Something 'at cost' is sold without a profit.
Something sold 'with costs' may have a profit added.
Something that must be done 'at all costs' must be done whatever the personal consequences.
There are some more details concerning the matter in question.
To sell smth. at cost = to sell smth. at cost price
the cost price of an article, the cost price of producing it or the price at which it may be bought wholesale
cost price = the price paid by a merchant for the goods he buys for resale. / a price that represents the bare cost of production, without anything added for profit.
with cost = liable to pay costs (yielding profit)
at the cost of = at the loss or expense of;
at all costs = at all prices = whatever the cast may be