Many indians kings and rich traders deposit their wealth into temples because they were considered safe due to their sacred status.
This is what attracted Mehmood Ghaznavi to invade various Indian temples to build a rich Afghanistan.
There was a story I read long ago....it is King of Gujrat who invited Mahmood to break the power of chief priest of Somnath temple, who had become so rich and powerful that he had the audacity to insult the royal family.... But I wonder why people did not learn from their mistake...Mahmood attacked Somnath Temple 17 times.... That means people kept on committing same mistake every year instead of using that wealth for defence of state or other purpose......