There may finally be a solution to helping middle-class San Franciscans who cannot afford to buy a home of their own in the city. Mayor Ed Lee on Tuesday will announce plans to create the city’s first dedicated funding stream for moderate-income and affordable housing, generating $20 million to $50 million a year for 30 years. The plan not only would help provide middle-income residents with up to $100,000 in down payment assistance, but it also is designed to stimulate market-rate development and fund 4,500 units of affordable housing. The money for Lee’s plan would come from a 0.2 percentage-point increase in the transfer tax on the sale of properties valued over $1 million, diverting 0.6 percent of the current tax levied on hotel stays and tapping future property tax revenue that would have gone to the city’s now-defunct redevelopment agency, according to documents from the mayor’s office. The proposal is slated to go before voters in November.