Deductions & credits

I don't think this answers question as this is regarding a lending credit.  Do you have to account for the lending credit in the closing costs?  Say the total closing costs on a refinance are $4000, but the lender gives you a credit of $3500 to help cover the costs.  Can you ammortize the full $4000 or only the $500 difference.