https://en.wikipedia.org/wiki/Israeli_support_for_Hamas
In a cable leaked by WikiLeaks in 2010, Amos Yadlin, former general of the Israeli Air Force, said in 2007 that Israel would be "happy" if Hamas take over Gaza and regarded it as a positive step, in order to make Gaza to be treated as a hostile state.
The details of money flow are complicated, but there are credible rumors of Israel funding Hamas via Quatar. There's a chance Hamas would have lost leadership to the Palestinian Authority had Israel not supported it during that era.
https://www.jpost.com/israel-hamas-war/article-799792
Former Mossad Chief admits to government funding for Hamas via Qatar, calls policy a mistake