If the case is as you mentioned,
that a person bought a car from another one on credit for more than its price in cash, and the buyer sold it to whom they want, besides the person who sold it, this is not considered Riba, but is a valid sale contract. However, if that person buys a car from (Part No. 13; Page No. 152) another person, so that they can return it for a lesser price in cash, this is considered selling a currency for another, which is Riba prohibited by Allah and His Messenger (peace be upon him). The contract of selling the car in this case is void, as it is meant to perform a trick to deal in Riba and get money through this trick. The same applies to the case of a person who sells the car to another person who is affiliated to its original owner; they agreed to sell the car to that person so that it returns to its original owner. All this is considered trickery and dealing in Riba.
May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.