Speaking from two different experiences, I'll give you two different answers:
First of all, my experience: in order for me to get a mortgage, the lender required that we pay off one of our two vehicles to bring down the debt:income ratio. A family member gifted the money to us. Our lender required that the donor sign a statement saying that the money was a gift and in no way requires a repayment of the money from us. The donor was also required to include their bank information: bank name, address, and account number. Since my family member wasn't comfortable with releasing his account information (he used a cashier's check to give us the money and so neither his name nor his account info was on the check), my lender required that he have his bank sign a memo on bank letterhead stating that the money came from his account and he had sufficient funds to cover it.
The second scenario is from my brother. His father-in-law sends him and his wife a significant check every year to encourage my brother and his wife to buy a plane ticket to visit them. His bank required proof of where the money came from and was also stating that they are going to require his father-in-law's account information. His father-in-law outright refused to give it, and my brother went back to his bank and told them that they could either move forward without it or my brother and his wife would just find another bank. His bank moved forward without the information.
Based on my brother's experiences and based on research my brother did on the Patriot Act (which is what has been thrown at me by my lender whenever I ask about it), I have concluded that it's not an actual requirement but a very very strong preference.
I think that at the end of the day, you just have to realize that the bank isn't required to give you a loan and if you want that loan, then you will likely need to be willing to give them whatever they want, unless what they're asking for is somehow illegal.