In Yusuf Ali's translation, we have a situation where the prophet Joseph engages in a deception by secretly placing a drinking cup inside his brother's bag as the brothers were departing, and then announces that they are thieves.
012.070 At length when he had furnished them forth with provisions (suitable) for them, he put the drinking cup into his brother's saddle-bag. Then shouted out a crier: "O ye (in) the caravan! behold! ye are thieves, without doubt!"
لَمَّا جَهَّزَهُمْ بِجَهَازِهِمْ جَعَلَ السِّقَايَةَ فِي رَحْلِ أَخِيهِ ثُمَّ أَذَّنَ مُؤَذِّنٌ أَيَّتُهَا الْعِيرُإِنَّكُمْ لَسَارِقُونَ
Does the message of this verse imply that in some cases, the ends justify the means, and that deception is permissible when used against deceivers? In this case Joseph's brothers had perpetrated a massive deception against their father Jacob when they threw Joseph into the well in his boyhood and told their father he was eaten by a wolf.
However, these kinds of permissible deceptions can present a huge moral hazard in implementation in sharia.