Ant Financial, Alibaba’s finance affiliate controlled by billionaire Jack Ma, agreed to buy a stake in the Brazilian payments firm StoneCo Ltd after the company prices its initial public offering, joining Warren Buffett in investing in Brazil’s booming financial-technology startup landscape.