In Maseches Kallah (5:1) it is related:אמרו עליו על ר״ט שהיה עשיר גדול ולא היה נותן מתנות לאביונים פעם אחת מצאו רבי עקיבא אמר לו רבי רצונך שאקח לך עיר אחת או שתים [אמר לו הן] מיד עמד ר״ט ונתן לו ארבעה אלפים דינרי זהב. נטלו ר״ע חלקו לעניים.לימים מצאו ר״ט א״ל היכן העיירות שלקחת לי תפסו בידו והביאו לבית המדרש והביא ספר תהלים והניחו בפניהן והיו הולכין וקורין עד שהגיעו לפסוק זה פזר נתן לאביונים וגו׳ א״ל זו העיר שקניתי לך. עמד ר״ט ונשקו ואמר לו רבי אלופי רבי בחכמה ואלופי בדרך ארץ והוסיף לו ממון לבזבז – “It is related about R’ Ṭarfon that, although he was very wealthy, he did not give gifts to the poor [in adequate manner]. Once R’ Aḳiva met him and said to him, ‘Master, would you like me to purchase one or two cities for you?’ He replied, ‘Yes’ and forthwith handed R’ Akiva four thousand golden dinars. R’ Aḳiva took the money and distributed it among the poor. Later R’ Ṭarfon met him and asked, ‘Where are the cities which you purchased for me?’ [R’ Aḳiva] took him by the hand and led him to the Beis Hamedrash. He brought a sefer Tehillim and placed it in front of them both. They went on reading until they came to the verse, He hath scattered abroad, etc., and then he exclaimed, ‘This is the city which I bought for you’. Thereupon R’ Ṭarfon stood up, kissed him and said to him, ‘My teacher and friend—my teacher in wisdom, my friend in social conduct’, and gave him still more money to distribute.”
We see from here that it’s ok to trick a rich person to get him to give tzedokah. The question is, however, what was the heter for R’ Akiva to lie to R’ Tarfon that he was going to buy him cities, when his real intention was to give it to the poor?
i) The Chida (Pesach Einayim, Bava 10, pg. 2) answers:
We find in Hilchos Tzedokah (248:1) that if one gives less tzedokah then he should be giving, beis din can hit him and force him to give what they have decided he is able to give, and they can even seize his assets. Since one is able to force one to give tzedokah against his will, certainly one is allowed to trick someone to get tzedokah from him. Therefore, it was permissible for R’ Akiva to trick R’ Tarfon.
ii) The Chofetz Chaim (Ahavas Chesed 2:14) also addresses this question
He explains that R’ Akiva wasn’t lying, as he said he would buy R’ Tarfon a city, and we find that the malachim and upper chambers which are created by one doing mitzvos are also called “cities”. See inside how he proves this.