It's not illegal to go to Cuba, it's just illegal to spend money there. As far as coming back, make sure Cuban Immigration does not stamp your passport coming or going. Easy enough. Use only cash, don't use a credit card, don't try global roaming with a cell phone, just use an unlocked GSM phone and buy a chip and credits while there.
If they can prove that you went to Cuba and spent money there, Treasury is who levies the fine, not CBP, since you're not banned from going there, just spending money.