In 2016, barely two years out of college, a 23-year-old San Francisco woman working in media purchased her first home. Sally French accomplished a generation-defying, mold-breaking feat, she wrote in a self-explanatory Marketwatch piece, she bought a home in San Francisco—a few blocks away from Twitter’s headquarters, in a new building, for $268,000.

She managed to do this while also presumably committing the cardinal sin of occasionally buying a piece of somewhat expensive toast, or going to a wedding, or taking part in any one of the reasons why millennials find it very difficult to afford to purchase their own home.

French and her positive experience with San Francisco affordable housing is “living proof,” she wrote, “that it’s possible to buy a home in San Francisco even if you’re not a millionaire.”

Related The best apps and websites for buying a home in SF

Everything she wrote is true. It is possible to score that white whale of San Francisco real estate: a unit of affordable housing the city’s “inclusionary housing program,” also known as the “BMR” (for “below-market rate”) program.

But there is indeed a catch of sorts. French’s experience may also not exactly be representative. In fact, it may be the exception that proves the rule—which is, in order to score an affordable condo in San Francisco, you must be one of several things all at once, in just the right amounts.

Please note that the city has postponed application deadlines for some listings due to the novel coronavirus outbreak. Check each listing for details. Paper applications received after March 16 will not be included in lotteries. Visit SF.gov to see more COVID-19 changes.

What is a below-market-rate home?

A below-market-rate home is but one form of that San Francisco black swan: affordable housing. BMRs come in two forms: rentals, for very low-income people, and for-purchase condos, for people who make a little bit more money—but not too much.

When did BMRs become a thing in San Francisco?

Since 2002, when the first tech boom was just about receding.

What types of buildings have BMRs?

You will find BMR rental units or condos in every new San Francisco building of ten units or more—or if you don’t, you will find them nearby, or in another building the developer was required to build. New construction of buildings with ten units or more must have affordable housing included, which is why it’s also called inclusionary housing.

How can I be a candidate for a BMR home in San Francisco?

You have to be a first-time homebuyer, and “you can’t have owned any property anywhere within the last three years.” You must make some money—enough to have saved enough to cover a down payment and the closing costs—but not too much so that you don’t qualify for the unit (there is an income cap that varies from home to home).

Can I get a BMR with a partner and/or a child?

Yes. Having a dependent partner or a child sometimes helps—and sometimes it hurts. Sometimes, as in the situation at an 800-square foot condo in Pacific Heights that KPIX highlighted in 2018, you must be some kind of unicorn: A family of four, with a combined income of no more than $92,250 a year, who has still managed to hang onto life in San Francisco while also still saving enough money for a down payment on a $400,000 property.

But being exceptional or exceptionally good with your money is not enough. Above all, you must be exceptionally lucky. Because in this city, affordable housing is also a literal game of chance.

Back up. Buying an affordable home here is like gambling?

Not exactly. But there is a lottery, as in a random drawing.

What are the odds of scoring a BMR?

Actually, not that bad—if you compare it to the California State Lottery, that is.

As Curbed SF reported, the Mayor’s Office of Housing, which runs the program, conducted 104 lotteries in 2017. There were over 85,000 applications for 1,210 units—including 1,510 bids for moderate-income units like French’s home, and 83,733 plays for one of 1,025 very-low to low-income rentals.

All in all, that’s about 1 in 70 chance.

How do I compete in the BMR lottery?

In order to compete in the housing lottery, you’ll have to sit through six hours of instruction with another two hours of one-on-one counseling.

Every time a new building goes up in San Francisco, the developer is required to either build on-site or pay for the building somewhere else of affordable housing. This is the “inclusionary” bit of the “inclusionary housing program.”

That the city does require private developers to help house a few low-income people is well-known. What’s less known are the minute details, because they changed in 2017.

As SPUR’s Kristy Wang explained:

New developments with 25 housing units or more are now required to either make 18 to 20 percent of their units affordable, build affordable units at another location equaling 30 to 33 percent of the total units, or pay an in-lieu fee equivalent to the cost of 30 to 33 percent of the units, which will then be used to build affordable housing elsewhere.

But wait, there’s more.

In addition, annual increases to the onsite requirement have now been established, which could potentially make future projects less feasible. The onsite requirement will increase by 1 percent on January 1, 2018, and January 1, 2019, and then increase 0.5 percent per year until it reaches 24 to 26 percent.

Sometimes affordable housing is also created wholesale out of one of the several pots of money the city has to build such things. This can take a very, very long time and does not happen often.

Other times, affordable units are created because of byzantine land transfers.

And other-other times, lucky winners, like Sally French, get tired of their white-whales-with-unicorn-horns and put their black swans and mixed metaphors up for sale.

These units exist; they are for sale. Can I just please buy one already?

It depends. You must qualify in order to be considered.

What are the income requirements for BMR consideration?

Take a peek at the income limits. You will see they are derived from the federal government’s “Metro Fair Market Rent Area (HMFA) that Contains San Francisco.” As of May 2019, the “area median income” was $86,200.

This is relevant because each BMR property has income limits. Look at the listings for a few examples. Try to find a unit or two that you might like, or for which you might qualify.

If you do qualify, there are a few more hoops, including the aforementioned six-hour workshop, a two-hour one-on-one counseling session, plus some credit and background checks to see if you will be approved for a loan.

Let’s assume you do check all of those boxes, and are now browsing the listings for likely units. Here’s one: 323 29th Street in Noe Valley.

It’s a 610-square-foot, two-bedroom, one-bathroom unit going for $536,517.

To qualify, you’ll have to have enough in the bank to cover a down payment—actually, more, considering the closing costs—and in addition to the mortgage, you’ll have to make enough to cover the $516 monthly HOA fees.

And you cannot make more than $86,200. Have a partner? The two of you can’t make more than $98,500. Oh, got a baby on the way—and a promotion? Hope the baby comes first, because the household income limit for a family of three is $110,850.

How else might I get a leg up in the lottery?

At 1235 McAllister, where a unit hit the market in 2018, any household in which a member held a Certificate of Preference from the Redevelopment Agency got first preference. If you also have a Displaced Tenant Housing Preference voucher, you got a leg up in the lottery—ditto if you could “submit acceptable documentation that at least one member lives or works in San Francisco.”

If I score a BMR, can I later decide to rent it out on Airbnb?

Absolutely not. In addition to being ethically sticky, renting out your below-market-rate home is illegal. People who have tried to do this were exposed and crucified on social media.

Is there a list of available BMR units and upcoming lotteries?

Here you go.

And for other affordable housing units in San Francisco not managed by the Mayor’s Office of Housing and Community Development, check out HomeownershipSF.org for a complete list.