Generally speaking, it more often advantageous to buy a vehicle back especially if you have additions/customizations on it that can be taken off easily.
IIRC from my brother's wreck the value that an insurance company can charge for buyback is capped (by law) at a very low percentage of the vehicle's value. I think it may be 18% but that could be state-specific. That is just what he was told by his agent. Anyways, he had a nice Ram Cummins with a high-end flat-bed, tool-boxes, air-compressor, fuel-tank etc. All-in, a $35k truck. He bought it back for around $7k, took his toolboxes, bed, fuel-tank etc off, put the original bed back on and listed it for $10k; a guy drove from Pennsylvania (over a day round-trip) to pick it up so it must've been a really good deal to him.