CarMax may not buy your car if you still owe on the car loan and are upside down on the car loan.
However you may be able to trade in the car to them and take out another car loan through CarMax.
So in a way CarMax may take your car as trade in when you're upside down on the loan and then pay that car loan off but then you'll still have to pay for another car through CarMax.
However things may have changed and the only way you can know for sure is to call CarMax or contact them online and ask them directly.
However you can most certainly trade in a car to CarMax that you still have a loan on from another lender and CarMax will pay off that loan and the lien and Title will then be transferred to CarMax.