The Brazil international signed a five-year contract with Barca when he moved to Spain from Atletico Mineiro in 2019, but spent the last two-and-a-half years at Betis.
Barca agreed the original deal in collaboration with Betis, with each club paying €6m and Barca reserving an option to pay Betis €9m this summer to end the loan and take the player to Camp Nou. Betis will also be due 20% of any future transfer.
Juan Miranda has moved in the other direction. The left-back, who spent last season on loan at Betis, has returned to the Seville-based club for free, although Barca will be due to 40% of any future transfer.
In just over two years at Betis, he has been a regular at right-back, making 79 appearances across all competitions and helping the club qualify for the Europa League this season.
He is with the Brazil national team preparing for this week's World Cup qualifiers and could be involved in the Copa America later this month in his homeland.