Directors of state lotteries, who live by the slogan "the house always wins," were startled yesterday to hear that for the past week and a half, Maryland has been losing.

But they promised that the luck of lottery ticket holders in Maryland - who broke the bank five days out of eight - will not last. After all, they point out, the State of Maryland sets the odds.

About 40,000 bettors - 15,000 more than usual - overcame 1,000-to-1 odds on five separate days last week to win $3 million more than gamblers paid in.

"It all works out in the long run," said George Mahoney, director of the Maryland lottery. "Sometimes the state has a winning streak and sometimes the bettors have a winning streak."

Lottery directors in other states said Maryland bettors' five-out-of-eight-day winning streak was "pretty odd" - so odd, in fact, that they had never heard of such an occurrence before.

"Two times in one week was the maximum that we paid out more than we took in," said Ralph Batch, executive director of the Delaware Lottery. "But of course it can happen more than that; it's all chance."

John Winchester, director of the Connecticut State Lottery, also expressed surprise at Maryland bettors' good luck. "I'm used to hearing about odds being broken, but that breaks some pretty high odds," Winchester said.

The odds against the lottery paying out more than it collected five times in eight days are 25,000 to 1.

But lottery directors said that it would be virtually impossible to "fix" a daily lottery like Maryland's. In the Maryland lottery, which occurs six times each week and is televised live, 10 balls with numbers zero through 9 are placed in each of three bins. A person in the audience whose name is selected from a barrel then picks out a ball from each of the three bins.

The three-digit number is that day's lottery number.

Lottery directors point out that the balls are weighed before being placed in each bin, and that a fan blows air into each machine so that all balls rise to the surface of the bin and each has a random chance of being selected.

Each year, Mahoney said, the lottery pays out about 50 percent of its income from ticket sales to winning bettors. About 40 percent of the money from ticket sales goes to the state's general fund, which is used for social services, maintenance of hospitals and schools. Another 10 percent used to pay the lottery's operating costs.

During 1977 the lottery paid $90 million to the state general fund and $115 million to winning bettors. By the end of 1978, lottery official officials expect to turn over $120 million to the state and $145 million to winners, said lottery spokesman Tom Skarzynski.

The latest winning streak for bettors began Nov. 6, when ticket sales totaled $921,536, and winners collected $995,950 on number 273. On Nov. 7, bettors wagered $881,007 and winners collected $882,750 on number 511. On Nov. 8, bettors wagered $821,325 and winners collected $2.5 million on number 721. On Saturday, bettors wagered $1 million but winners collected $1.1 million. Bettors wagered only $952,719 on Tuesday with number 777, but winners collected $3.1 million.