Maryland economic development officials have embarked on a $2.5 million campaign to lure businesses from seven major American cities and five foreign countries, although state officials admit that a recession would make many companies reluctant to move anywhere.

As part of their new effort, state officials are planning to raid high-technology firms in the Los Angeles area, much like their highly publicized blitz on such firms in the Silicon Valley section of California in April.

Those firms are more resistant to recessions, said Jimmy O. Roberson, secretary of the Maryland Department of Economic and Community Development. The silicon Valley trip produced 25 prospects but nothing definite yet, officials said yesterday.

Roberson said this campaign is different from last year's $2 million effort to attract businesses because it is "more definitive, more polished, more focused." The 1978 budget was $700,000.

The 1980-1981 plan, unveiled to reporters yesterday, begins with missions to New York and ends next June in Detroit and Chicago. In between are buttonholing trips to Boston, Cleveland, Philadelphia, Pittsburgh, Toronto, Montreal and cities in Japan and Europe. State officials also will host functions for business and government officials from Canada, Japan and France.

One focus of the trips will be the Baltimore Port, said Gerald McDonald, director of the office of business and industrial development. "We know that there is a lot of flow in that port," McDonald said. "We can turn that flow into the establishment of other facilities."

Another focus will be Japanese firms, he added. In that area, "We're just getting our feet wet in attracting business to Maryland."

In addition, state officials will lobby what they call "second-generation Japanese" technology firms on the West Coast to persuade them to locate in Maryland.

They also plan to leave no major northern city untoured. "That's where the action is, and that's where we want to go," Roberson said.

Asked what the officials are doing to keep existing firms from moving out, Roberson said that they keep in contact with those firms but that he doesn't know how many have left the state. He also said he can do nothing to prevent other state economic development agencies from raiding Maryland.