I used to greet the Prophet ﷺ while he was in prayer and he would return my greeting, but when we returned (from Ethiopia) I greeted the Prophet (while he was praying) but he did not return the greeting, and (after finishing the prayer) he said, "In the prayer one is occupied (with a more serious matter)."
كُنْتُ أُسَلِّمُ عَلَى النَّبِيِّ ﷺ وَهُوَ فِي الصَّلاَةِ فَيَرُدُّ عَلَىَّ فَلَمَّا رَجَعْنَا سَلَّمْتُ عَلَيْهِ فَلَمْ يَرُدَّ عَلَىَّ وَقَالَ إِنَّ فِي الصَّلاَةِ شُغْلاً