Gruyère cheese is too expensive here and I want make quiche lorràine. Is there some other cheese that I could substitute for the gruyère that would preserve the original flavor? 
If you want to be faithful to the French terminology, a quiche (lorraine) does not contain cheese. Ever. It's not even a matter of being "classic" or  "authentic", putting cheese on a tarte is very common, but it's just called differently if you do (namely tarte). Have you ever tried an actual French quiche (i.e. without cheese)? Maybe you will like it.  Alternatively, you can put just about any cheese on it. Results will differ, hard somewhat aged cow-milk cheese like those suggested by @Jefromi will be closest to gruyère but anything goes really: Dutch cheese, soft cheese like maroilles or munster, blue cheese, goat cheese, feta cheese, feel free to experiment with what's available where you are.  Incidentally, if anything, I think it's actually more common to add a relatively bland, creamy cheese like emmentaler rather than a stronger older cheese to a tarte so there is no reason to consider the latter as the ingredient to be substituted or a tarte with gruyère as the "original flavor" to aim for.  Now if you like that and want to do it on the cheap, then maybe comté or beaufort are not very good options, as they might be just as expensive and possibly harder to find. I would try to look for an aged Dutch-like cheese (locally produced Gouda imitation or something like that). 