As I have argued in one of my previous posts, Knowing the Law vs Complying With The Law, people respond to incentives. You cannot expect that people will comply with the law simply because they know the law. To the extent that the benefit of doing a crime is higher than the costs, it is most likely that a criminal will conduct his crime. Thus, in law and economics view, we need legal enforcement to impose sanctions to criminals with a hope that such sanctions will increase the costs of doing criminal activities and can induce the criminals to reduce their negative activities.
Based on the above insight, no wonder that religion, standing alone, cannot be expected to significantly reduce the level of criminal activities simply because religion does not impose any sanction in the current life. You may be aware that certain religions offer a terrible afterlife sanctions for whoever dare to violate religion rules. While we can always debate on what constitutes religions rules, the issue is clear, although the sanctions are so vicious (burned alive and might be for an eternity too) that they cannot be comprehended by any ordinary human beings, they will only happen in the after life.
Some behavioral law and economic researches show that in general, people tend to discount the occurrence of bad things in the future even though they know that their current actions can increase the likelihood of those bad things. Good example: we know that overeating and less body exercise can be translated into higher probability of various nasty sickness, including heart attack, stroke, and diabetes. Yet, most people tend to discount that probability by staying with their unhealthy lifestyle (shamefully, I am also in the same category). It is also usual that significant changes in behavior will only occur after these people experience the problem by themselves. As an example, rate of doing healthy lifestyle activities will increase for people who have experienced heart attack and survive. That kind of experience will most likely leave a scar (or in economic terms, huge costs) in their life and they will have strong incentives to alter their behavior.
Returning to religiosity, not only that afterlife sanctions will be hugely discounted in considering them as a cost of doing criminal activities, there are several concepts in religion that can significantly reduce the value of such afterlife sanctions. Consider the concept of repentance of sins (taubat) that exist in any type of religion. This concept allows all believers to be forgiven by God from all of their sins to the extent they faithfully stop all of their previous heinous activities and do many good things as a repayment to the society. You can say from law and economics perspective that this is in line with the principle that criminals should compensate the society for the costs that these criminals impose to the society due to their criminal activities. That's true, but you must also consider the fact that the concept of repentance is not as effective as you think would be.
First, there is an issue on when should a person commit repentance? Since this can be done in any time before he dies and if we assume that people also discount the possibility of them dying at a time nearby, you can bet that most criminals will choose to repent far far away in the future. Even worse, since there is no minimum standard repayment for repentance, there is a possibility that such repayment activities are not suffice to cover the costs of their previous criminal activities. Obviously, that is not efficient for crime preventing. We are happy that religion provides an incentive for criminals to repay their sins in this world but without any clear enforcement mechanism, the repayment can be too late or not enough at all.
Second, since there is a possibility for multiple offenses and also multiple repentance, there are no strong incentives for religious people to comply with the law. They can always say that they are weak, that God is forgiven and all is well. Yes, we can argue that God might not agree with these people in relation to the faithfulness and intensity of their repentance, but no ones know what God really thinks. Uncertainties in this type of case increase the discount of afterlife sanctions, rendering their effectiveness into a new low level.
Having said that, the case is also similar for any moralists out there. We learn from one of US founding fathers, James Madison, that people are not angels. According to him, if people are angels, we do not need government, but since we know that they are not, we need a government to supervise them, and we also need further mechanism to check and balance the government since they consist of people too. You can claim that righteousness can come from many different ways, but you are just an ordinary human, and not all human can resist temptations.
Let me give you a simple example on insider trading cases. In the US, it is not unusual to find lawyers who still conduct insider trading cases even though they know the law and the severe punishment that will be imposed to them for doing such activities. Yet, some lawyers fall under insider trading cases. How could that be? Because the temptation is very high, we are talking about millions and millions of dollars here! And it is so easy to do insider trading that unless you can find a good way to remind yourself of the risks, you will most likely do it. And when they actually do it, you should ask why? Because again, they discount the probability of them getting caught because they know the law and they feel that they can avoid liability through their legal skills. Try to compare this with the fact that the Department of Religion handles an excessive amount of money from the government for hajj purposes. Do you think they are mentally strong enough to fight their temptations?
As you can see, even in the case of clear and severe punishments, some people cannot resist the temptations and end up doing their criminal activities. They might have already calculated the costs and benefits of their actions, where higher risks are translated into higher return. So, what can you expect from severe sanctions that will only occur in the future, the possibilities of them happening are pretty much uncertain, and there are many ways to avoid those sanctions with low costs(i.e. repentance)? The end result is clear, religion or morality, standing alone, is not effective to prevent people from doing criminal activities.
To close this post, I disagree that people are using this fact to blame religion as a source of evil. While religion and morality are not effective when they are standing alone, they can become a nice addition for strong legal enforcement. In his book, Predictably Irrational, Dan Ariely, a famous behavioral economist, shows that religion and morality can be useful tools in increasing the commitment of people to walk in the right path (especially by repeating such moment of commitments every day), i.e. as a method to increase their awareness that what they are doing is bad. But remember, they are only additional psychological tools, and effective strong legal enforcement would always be mandatory and necessary if we want to effectively reduce the rate of criminal activities.