Did your friend tell you that they were able to roll their closing costs into their loan and you are being advised that this can't happen on a purchase?
It's a common misunderstanding that we come across often.
Closing costs cannot be rolled into the loan if you are purchasing. The only cost that can be rolled in would be a funding fee (only on FHA and VA loans).
Your friend was either able to get a seller credit, increase the purchase price to cover closing costs (the property must appraise for the purchase price) or receive a lender credit by going with a higher interest rate.
Closing Costs are fees that you pay when you purchase a home. These fees include county and state recording charges, transfer fees, escrow and title fees, property taxes, homeowners insurance, etc.
When you are refinancing. Refinances are the only loan type that allow costs to be rolled in.
You don't pay the costs until you close on the home.