Hamas security forces later seized control of the crossing, which is regularly closed by Israel leaving thousands of Palestinians stranded in Egypt or stuck within the territory. Twenty people were wounded.
Haniya's convoy sped away after the attack and officials said he was unharmed.
Haniya said: "We know the party that shot directly at our cars ... and we also know how to deal with this."
Fawzi Barhum, a Hamas spokesman, said the attack was "a planned attempt by Force 17 [the presidential guard] to assassinate brother Ismail Haniya".
"We want Mahmoud Abbas to order that those responsible be found."
"We know the party that shot directly at our cars ... and we also know how to deal with this"
Ismail Haniya, Palestinian prime minister
Haniya cut short a trip abroad in order to return to Gaza to quell recent conflict between Hamas and Fatah.
But Israel closed the Rafah border shortly after he arrived at an airport nearby.
His delegation was held at the border for about seven hours as Israel blocked him from bringing the cash into Gaza.
He was finally allowed to cross late on Thursday night, but was forced to leave the money behind. The money is needed by the Palestinian government to pay salaries after Israel, the US and the EU imposed an economic blockade.
Maria Telleria, a spokeswoman for European monitors at the crossing, said Haniya left the funds in Egypt.
Javier Solana, the EU foreign policy chief, said: "The money he was carrying is not across the border, it is now in a bank in Egypt."
Rafah terminal storm
At least 20 people were wounded in clashes at the border between armed men from Hamas and the rival Fatah faction of Abbas, the Palestinian president.
Hamas fighters, angry that Israel was preventing Haniya from returning, stormed the terminal.
The pro-Fatah presidential guard, responsible for securing the area, opened fire.
The European monitors who police the crossing fled.
'Let's liberate this place'
Hamas security officials chanted "God is Great, let's liberate this place" as they took over the arrival hall, and border guards escorted the European monitors to safety.
Two loud explosions rocked the area, and security officials said Hamas officials blew a hole in the border fence about half a mile from the terminal.
|More than 50 men greeted Haniya|
Thursday's unrest is likely to strain the US-brokered deal that turned over control of the crossing to the Palestinians last year after four decades of Israeli control. The border can only operate in the presence of European monitors.
A senior Israeli security official said Amir Peretz, the Israeli defence minister, had ordered the border to be closed not to block Haniya's entry but to keep the money out.
Haniya left Gaza on November 28 for what was supposed to be a month-long trip around the region, with the goal of raising money for his government.