Part of the beauty of real estate is the capability to split the benefits and assign them to the party who values them the most in the transaction.
Decide what benefits you want to retain in this transaction and which benefits your former roommate wants to enjoy, then structure a transaction that gets you where you want to go.
There may be multiple ways to satisfy everyone in the deal. Think creatively.
Suppose, for instance, that you purchase the property in your name and retain the deed. You then sign a lease with your ex-roommate which allows her to live in the apartment. The lease payments might be equal to your mortgage payment, which would be fair since she is going to enjoy the benefit of the use of the property. You avoid negative cash flow and have a built-in property manager. (But still watch things. It is your property after all.)
You also sell her an option to purchase an undivided 50% interest in the ownership of the property as tenants in common anytime in the next five years. Make her option void if she flakes out under the lease. This protects you by putting her money at risk if she does not perform as she agreed.
Her option consideration might be the funds she now has on hand for the down payment. You could use these funds as part of your down payment when you close on the property. As such, it is not borrowed money, (You don’t have any obligation to pay it back), so the lender should go along with the deal as long as the option is not recorded before the mortgage.
Later when you sell the property, you split the proceeds based on your equity percentage of ownership. That is, assuming she has exercised her option to buy the 50% interest, you split the profits fifty-fifty. It is also advisable to have a good agreement (in writing) regarding when and how you will sell the property, as well as the terms to buy out each other’s interest in case you disagree later about selling the property.
The "credit " for getting a good purchase price will be reflected in her lower lease payments (because the bargain purchase means you have smaller mortgage payments) and the larger capital gain you both will split when you eventually sell the property.
See how this works? Play around with the combinations so that everyone gets what they need on the deal. Negotiate the best deal you can for youself, and protect your interest, but leave enough on the table for the other person to win, too.