An idiom from Dostoyevsky
It's a proverb, not an idiom. From the point of view of a Russian-speaker: the meaning is: someone is your "friend" only when you are successful (share your bread), but when you have troubles, they leave you alone (or when they are more successful, they don't share their tabacco "sniff"). Similar to "a friend in need is a friend indeed" but more strict. As for the second question - it all depednds on the translator. There are a lot of similar idioms/proverbs in many languages, using them by mere translation you can always use a footnot or just throw it away if it doesn't change the passage.
As Robusto notes in a comment beneath the posted question, the word sniff in the cited proverb should be snuff. Here is the passage from Crime and Punishment (in David McDuff's translation), as published by Penguin Books (1991):
Of course, you've a common commercial interest here, something undertaken to mutual advantage and in equal shares, the expenses split fifty-fifty, in other words; “some bread and salt together but a pinch of snuff apart,” as the saying goes.
An earlier translation (by an unidentified translator) in an edition of the novel published in 1886 offers this alternative translation:
Of course, this is an ordinary business transaction, an affair of mutual profit and equal shares ; consequently the expenses must be shared equally. Bread and salt together, but each his own tobacco, according to the proverb.
Edgar Lehmann, A "Handbook" to the Russian text of Crime and Punishment (1970) offers this very brief explanation of the original Russian proverb:
lit: bread and salt together, but tobacco separately; fig: everything has a limit; don't go too far.
The practical sense of the expression seems to be that it's all very well to be willing to share simple, basic, inexpensive essentials (like bread and salt), but it is quite another to be openhanded with something expensive and relatively hard to come by (like tobacco).
In the context in which Raskolnikoff uses the expression, in his interior monologue about his mother's impending marriage, he implies that the person who has adopted a share-and-share-alike attitude toward travel expenses is meanwhile slyly excluding certain things of value from the catalog of things to be shared.