It's not every time that things happen with a plan. Sometimes thing happens in the reaction of an action. Surrounding circumstances force something to happen. People try to get a solution in tight situations. They try to get rid of the situation at any cost. Sometimes it necessary to take steps required for their survival.
Same is the case with Iran as said above. After the U.S sanctions Iran’s Economy affected very badly. Inflation rate increases as a reaction to these actions. Iranian People started crypto mining in a reaction to these sanctions. The steps were taken for their own survival. Crypto Mining is not banned in the country but the import of new mining machines is stopped due to excessive use of electricity for mining. Import of mining machines will be open after taking the necessary steps for electricity consumption.
Mohammad Javad Azari Jahromi Iran’s Minister said that “The business of ‘mining’ is not forbidden by law but the government and the Central Bank have ordered the Customs Bureau to ban the import of [mining machines] until new regulations are introduced,”
It's favorable for miners to mine crypto in Iran. Because of electricity cost in developed countries at $0.20 per Kilowatt-Hour. Whereas in Iran its cost is $0.06 kWh. So people of Iran get the solution to their problem by mining crypto.