If you are buying and you wish to ask the seller for a credit for recurring and/or non recurring closing costs then there is never any harm in asking. Make sure it is documented properly in the purchase agreement or an addendum so that the lender knows what is going on. I do not believe the lender will be agreeable if the credit is more then 3%. There have been cases where the credit can exceed that amount but that would imply that portions of the credit were for repairs or upgrades. In that case those extra credits may be held back by escrow to be paid directly to the contractor who does the work. Also I have not seen cases where a buyer walks away with cash after the credit. In cases that I have seen where the credit from the buyer exceeds all of the closing costs for the buyer, I have not seen the lender allow the buyer to walk with the excess credit in cash.
I do recall some posts where people said that had seen that occur so go figure.