Investing Solutions received those benefit payments over the past two years by finding properties for single homeless men.
The charity, Fresh Start Housing, finds clients from London homeless charities.
Neither the charity nor the company act illegally, but a homeless group says the relationship is "a new low".
Investing Solutions said "the bulk" of their rents get passed to private landlords, while Fresh Start said they referred clients to both Investing Solutions and private landlords.
The letting agent makes money by putting several unrelated people in one house and charging housing benefit for each person, rather than the property. Therefore, the total benefit payout is higher than the rent fee passed on to the property's landlord.
Both Investing Solutions and Fresh Start are based in the same building, a storage unit in south London.
Records held at Companies House show Investing Solutions was set up in 2002 by Samir Patel, who then set up Fresh Start Housing in 2010.
The documents say the charity would help "the needs of current and ex-offenders with a wider goal to reduce poverty, sickness and distress".
Operating across seven London boroughs, Investing Solutions is one of the largest recipients of housing benefit in the UK, making the venture hugely profitable.
In one property we visited, Investing Solutions was claiming £2,114 per month in housing benefit for two tenants.
The owner of the house was getting £1,150 per month, giving the agency an annual gross profit of £11,568 on the one property.
The company focuses on providing housing to single homeless men over the age of 35, saying that is because this is the group facing "the greatest challenges in accessing accommodation".
But housing benefit legislation allows people aged 35 and over to be housed in private rather than shared accommodation. In the boroughs in which Investing Solutions operates, that means they can charge up to £260 per week for each private room.
One of the tenants, Nigel McCann, was living in a homeless shelter when he was referred to Fresh Start Housing. They passed him to Investing Solutions who housed him in several properties that he describes as wholly unsuitable - various problems included lack of heating and hot water, rats and damp.
He says he had to remove 28 bags of rubbish from one house to begin to make it habitable.
Mr McCann said he became aware of how profitable Investing Solutions was after he did some work for them in 2014.
"It's all about the money, it's not about the people," he added. "I thought inspections would be made."
Nearly half the money that Investing Solutions has received over the past two years has been paid by Wandsworth Council in south London, which has paid the lettings agency more than £2.1m.
The council said it has a "dedicated Private Sector Housing Team who provide specialist advice to both landlords and tenants to ensure the private rented sector in the borough is safe, secure and affordable".
Matt Downie, of homeless charity Crisis, said: "We've heard many examples of poor practice amongst letting agents as well as good practice. But this idea of having a charity tacked on to poor practice is a new low."
Samir Patel said in a statement that Fresh Start Housing was an independent charity with its own board of trustees.
He also said the majority of the properties used were sourced from private sector landlords "who, to make exceedingly clear, own the properties. The simple point being, the bulk of the rents gets passed to our private sector landlord clients".
He also said his company was "genuinely concerned by some of your allegations concerning the state of one of our landlord client's property".
Fresh Start Housing told us it had housed 788 homeless people since it was founded and 222 homeless people in the last 12 months, including re-housed tenants.
It also said it did not have "authority from the relevant parties" to reveal how many were housed with Investing Solutions.
A spokeswoman for the Department for Communities and Local Government said local authorities were responsible for "rigorously safe-guarding taxpayers' money, with dedicated investigations and inspection teams for private sector housing".
A letting agency has been paid more than £5.5m in housing benefit after its owner set up a charity to help the homeless, the BBC has learned.