Temples serve various needs in Japanese society, and there are many ways they do this. The stereotype Japanese temple concentrates on selling expensive funerals and cemetery plots. It's true that Buddhism has been pretty much the 'go to' for funerary needs since the early days. One interesting thing about Buddhism in Japan is that it denied the supposed 'pollution' of death that existed in native religion. So that sounds good to me. On the other hand, the image of Buddhism in Japan was such that a satirical movie was made about greedy funeral directors and Buddhist priests, and clumsy family members. However, in my experience, Buddhist priests are very compassionate, flexible and comforting. Anyway, it is true that lots of temples basically exist to take care of the funerary needs of their congregation. These temples mostly do not allow tourists. I met a Zen priest in Hokkaido that spent most of every day going around to homes to conduct memorial ceremonies--in Japan, these are not finished with just the funeral ceremony. There are ceremonies for 7 days after death, 49 days, one year, three years, seven years and on and on. Not everyone does all of these, but there were enough in Hokkaido for my friend to be pretty busy with just that. So in the most extreme case, this kind of temple won't even open its gate. Still, some people will come there and put their hands together (gassho 合掌)in front of the gate. However, many of these temples open their gates, and anyone is free to walk in quietly and do a gassho in front of the main hall and any Buddhist images that may be visible (and put a coin in the box, of course). Beyond that, you may be able to peek inside a sanctuary, either through a glass panel or through the slightly opened door. It may be possible to remove your shoes and step inside in some cases. If by chance you should have a conversation with anyone there, avoid terms like sightseeing, I just wanna see it, and so on. Please use 'o mairi shimasu' (お参りします)which indicates worship. Indeed there are temples which welcome sightseers (and their money) but for the sake of form, it is better to use 'haiken' 拝見 a more polite form of the verb 'to see.' In fact the first kanji of haiken means 'to worship,' suggesting that seeing the Buddha is important, and also that polite language in Japanese has ties to Buddhism.
At the other end of the spectrum are temples like Sensoji in Asakusa. It has no congregation and no cemetery, therefore none of the income support from those sources. However, great crowds are always there, and you can walk into the main sanctuary with your shoes on. The donation box is roughly the size of a flatbed truck. On New Year's Day, I shuffled slowly in a huge crowd for an hour or more to get into the main hall for Hatsu Mode 初詣, the first visit of the new year.
Here are some pix: a very quiet neighborhood temple, and Sensoji on New Year's Day.